diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 83d7d6d..64c17c6 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -31,7 +31,7 @@ jobs: TARGET_DB: ${{ matrix.database }} steps: - name: Checkout code - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: Setup Ruby and install gems uses: ruby/setup-ruby@v1 with: diff --git a/lib/solid_cache/store.rb b/lib/solid_cache/store.rb index 43b0f0f..3463958 100644 --- a/lib/solid_cache/store.rb +++ b/lib/solid_cache/store.rb @@ -23,10 +23,14 @@ def initialize(options = {}) super(options) @max_key_bytesize = MAX_KEY_BYTESIZE @error_handler = options.delete(:error_handler) || DEFAULT_ERROR_HANDLER - clusters_options = (options.key?(:cluster) ? [options.delete(:cluster)] : options.delete(:clusters)) || [{}] + + clusters_options = options.key?(:cluster) ? [options.delete(:cluster)] : options.delete(:clusters) + clusters_options ||= [{}] + @clusters = clusters_options.map.with_index do |cluster_options, index| Cluster.new(options.merge(cluster_options).merge(async_writes: index != 0)) end + @primary_cluster = clusters.first end