rails_failover 2.1.0 → 2.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 696636b3992c9893a48a23366f760af354c496bbd1573754bdd92b66fc9913ff
4
- data.tar.gz: 8994846710a6765afffc3a60845bc696efb53e44d532a04092d3a6ba87adf4d9
3
+ metadata.gz: cc30e56251321fcdacf633da4dba5d747e939d315d1ccb7db65796ef8facd654
4
+ data.tar.gz: 63f9f2f3dd7bd794c648f396115629d84705035f0136a49d60c1c97d1b52032f
5
5
  SHA512:
6
- metadata.gz: fe74527339c42947a6205a231f6035af8e039809db86df7d64edb34d02d3cf59fa4f814b05e28f077dd89a61448b5fcde1d70094a5f6c90c81d31cb73d4bd059
7
- data.tar.gz: f3a8df28c08ddd305833f1c3ad630c8c3f270bb398aa6698e39b74a413ba03c03614986e3da944e061547d8d70c764b92c90767b2e1bec045a1661cd941563a5
6
+ metadata.gz: 1123d003526ea98b4ee857e74217a93938adfb59215b8b3e8f627044ec439a2709ecdb431b004dbf52b5d34046bdcadee2571265a75802492da81f2a7d7a90fc
7
+ data.tar.gz: 919021b80af3b14829c9c27e0092490bb93b2e50dbbb983883ddf894711a05e2707b161f478587a791ab0dad991954a7a529134ec40b2dc9b9dd74f6f495a8f3
@@ -16,7 +16,7 @@ jobs:
16
16
  - name: Setup ruby
17
17
  uses: ruby/setup-ruby@v1
18
18
  with:
19
- ruby-version: '3.2'
19
+ ruby-version: "3.2"
20
20
  bundler-cache: true
21
21
 
22
22
  - name: Rubocop
@@ -29,13 +29,13 @@ jobs:
29
29
  bundle exec stree check Gemfile rails_failover.gemspec $(git ls-files '*.rb')
30
30
 
31
31
  redis:
32
- name: 'Redis (Ruby ${{ matrix.ruby }})'
32
+ name: "Redis (Ruby ${{ matrix.ruby }})"
33
33
  runs-on: ubuntu-latest
34
34
 
35
35
  strategy:
36
36
  fail-fast: false
37
37
  matrix:
38
- ruby: ['3.4', '3.3', '3.2', '3.1']
38
+ ruby: ["3.4", "3.3", "3.2", "3.1"]
39
39
 
40
40
  steps:
41
41
  - uses: actions/checkout@v3
@@ -44,7 +44,9 @@ jobs:
44
44
  uses: ruby/setup-ruby@v1
45
45
  with:
46
46
  ruby-version: ${{ matrix.ruby }}
47
- bundler-cache: true
47
+
48
+ - name: Setup gems
49
+ run: bundle install
48
50
 
49
51
  - name: Setup redis
50
52
  run: sudo apt-get install redis-server
@@ -54,21 +56,21 @@ jobs:
54
56
 
55
57
  active_record:
56
58
  runs-on: ubuntu-latest
57
- name: 'ActiveRecord ~>${{ matrix.rails }} (Ruby ${{ matrix.ruby }})'
59
+ name: "ActiveRecord ~>${{ matrix.rails }} (Ruby ${{ matrix.ruby }})"
58
60
 
59
61
  strategy:
60
62
  fail-fast: false
61
63
  matrix:
62
- ruby: ['3.4', '3.3', '3.2', '3.1']
63
- rails: ['7.1.0', '7.0.0']
64
+ ruby: ["3.4", "3.3", "3.2", "3.1"]
65
+ rails: ["7.1.0", "7.0.0"]
64
66
  include:
65
- - ruby: '3.2'
66
- rails: '6.1.0'
67
+ - ruby: "3.2"
68
+ rails: "6.1.0"
67
69
  exclude:
68
- - ruby: '3.4'
69
- rails: '7.0.0'
70
- - ruby: '3.3'
71
- rails: '7.0.0'
70
+ - ruby: "3.4"
71
+ rails: "7.0.0"
72
+ - ruby: "3.3"
73
+ rails: "7.0.0"
72
74
 
73
75
  steps:
74
76
  - uses: actions/checkout@v3
@@ -84,13 +86,20 @@ jobs:
84
86
  - name: Setup postgres
85
87
  run: |
86
88
  make setup_pg
87
- make start_pg
88
89
 
89
90
  - name: ActiveRecord specs
90
91
  env:
91
92
  RAILS_VERSION: ${{ matrix.rails }}
92
93
  run: bin/rspec active_record
93
94
 
95
+ - name: Dump Unicorn STDERR logs
96
+ if: ${{ failure() }}
97
+ run: cat spec/support/dummy_app/log/unicorn.stderr.log
98
+
99
+ - name: Dump Rails logs
100
+ if: ${{ failure() }}
101
+ run: cat spec/support/dummy_app/log/production.log
102
+
94
103
  publish:
95
104
  if: github.event_name == 'push' && github.ref == 'refs/heads/main'
96
105
  needs: [lint, redis, active_record]
data/.gitignore CHANGED
@@ -16,4 +16,5 @@
16
16
  *.rdb
17
17
 
18
18
  *.gem
19
- Gemfile.lock
19
+ **/Gemfile.lock
20
+ !/Gemfile.lock
data/.rspec CHANGED
@@ -1,3 +1,4 @@
1
1
  --color
2
2
  --require spec_helper
3
3
  --format documentation
4
+ --order random
data/CHANGELOG.md CHANGED
@@ -5,7 +5,12 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [2.1.1] - 2024-07-02
9
+
10
+ - FIX: Falling back to primary PG server not reliable on Rails 7.1
11
+
8
12
  ## [2.1.0] - 2024-05-29
13
+
9
14
  - DEV: Update dependencies to officially support Rails 7.1
10
15
 
11
16
  ## [2.0.1] - 2023-05-30
data/Gemfile.lock ADDED
@@ -0,0 +1,205 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ rails_failover (2.1.1)
5
+ activerecord (>= 6.1, < 8.0)
6
+ concurrent-ruby
7
+ railties (>= 6.1, < 8.0)
8
+
9
+ GEM
10
+ remote: https://rubygems.org/
11
+ specs:
12
+ actionpack (7.1.3.4)
13
+ actionview (= 7.1.3.4)
14
+ activesupport (= 7.1.3.4)
15
+ nokogiri (>= 1.8.5)
16
+ racc
17
+ rack (>= 2.2.4)
18
+ rack-session (>= 1.0.1)
19
+ rack-test (>= 0.6.3)
20
+ rails-dom-testing (~> 2.2)
21
+ rails-html-sanitizer (~> 1.6)
22
+ actionview (7.1.3.4)
23
+ activesupport (= 7.1.3.4)
24
+ builder (~> 3.1)
25
+ erubi (~> 1.11)
26
+ rails-dom-testing (~> 2.2)
27
+ rails-html-sanitizer (~> 1.6)
28
+ activemodel (7.1.3.4)
29
+ activesupport (= 7.1.3.4)
30
+ activerecord (7.1.3.4)
31
+ activemodel (= 7.1.3.4)
32
+ activesupport (= 7.1.3.4)
33
+ timeout (>= 0.4.0)
34
+ activesupport (7.1.3.4)
35
+ base64
36
+ bigdecimal
37
+ concurrent-ruby (~> 1.0, >= 1.0.2)
38
+ connection_pool (>= 2.2.5)
39
+ drb
40
+ i18n (>= 1.6, < 2)
41
+ minitest (>= 5.1)
42
+ mutex_m
43
+ tzinfo (~> 2.0)
44
+ ast (2.4.2)
45
+ base64 (0.2.0)
46
+ bigdecimal (3.1.8)
47
+ builder (3.3.0)
48
+ byebug (11.1.3)
49
+ concurrent-ruby (1.3.3)
50
+ connection_pool (2.4.1)
51
+ crass (1.0.6)
52
+ diff-lcs (1.5.1)
53
+ drb (2.2.1)
54
+ erubi (1.13.0)
55
+ i18n (1.14.5)
56
+ concurrent-ruby (~> 1.0)
57
+ io-console (0.7.2)
58
+ irb (1.13.2)
59
+ rdoc (>= 4.0.0)
60
+ reline (>= 0.4.2)
61
+ json (2.7.2)
62
+ language_server-protocol (3.17.0.3)
63
+ loofah (2.22.0)
64
+ crass (~> 1.0.2)
65
+ nokogiri (>= 1.12.0)
66
+ minitest (5.24.1)
67
+ mutex_m (0.2.0)
68
+ nokogiri (1.16.6-aarch64-linux)
69
+ racc (~> 1.4)
70
+ nokogiri (1.16.6-arm-linux)
71
+ racc (~> 1.4)
72
+ nokogiri (1.16.6-arm64-darwin)
73
+ racc (~> 1.4)
74
+ nokogiri (1.16.6-x86-linux)
75
+ racc (~> 1.4)
76
+ nokogiri (1.16.6-x86_64-darwin)
77
+ racc (~> 1.4)
78
+ nokogiri (1.16.6-x86_64-linux)
79
+ racc (~> 1.4)
80
+ parallel (1.25.1)
81
+ parser (3.3.3.0)
82
+ ast (~> 2.4.1)
83
+ racc
84
+ pg (1.5.6)
85
+ prettier_print (1.2.1)
86
+ psych (5.1.2)
87
+ stringio
88
+ racc (1.8.0)
89
+ rack (3.1.6)
90
+ rack-session (2.0.0)
91
+ rack (>= 3.0.0)
92
+ rack-test (2.1.0)
93
+ rack (>= 1.3)
94
+ rackup (2.1.0)
95
+ rack (>= 3)
96
+ webrick (~> 1.8)
97
+ rails-dom-testing (2.2.0)
98
+ activesupport (>= 5.0.0)
99
+ minitest
100
+ nokogiri (>= 1.6)
101
+ rails-html-sanitizer (1.6.0)
102
+ loofah (~> 2.21)
103
+ nokogiri (~> 1.14)
104
+ railties (7.1.3.4)
105
+ actionpack (= 7.1.3.4)
106
+ activesupport (= 7.1.3.4)
107
+ irb
108
+ rackup (>= 1.0.0)
109
+ rake (>= 12.2)
110
+ thor (~> 1.0, >= 1.2.2)
111
+ zeitwerk (~> 2.6)
112
+ rainbow (3.1.1)
113
+ rake (13.2.1)
114
+ rdoc (6.7.0)
115
+ psych (>= 4.0.0)
116
+ redis (4.8.1)
117
+ regexp_parser (2.9.2)
118
+ reline (0.5.9)
119
+ io-console (~> 0.5)
120
+ rexml (3.3.1)
121
+ strscan
122
+ rspec (3.13.0)
123
+ rspec-core (~> 3.13.0)
124
+ rspec-expectations (~> 3.13.0)
125
+ rspec-mocks (~> 3.13.0)
126
+ rspec-core (3.13.0)
127
+ rspec-support (~> 3.13.0)
128
+ rspec-expectations (3.13.1)
129
+ diff-lcs (>= 1.2.0, < 2.0)
130
+ rspec-support (~> 3.13.0)
131
+ rspec-mocks (3.13.1)
132
+ diff-lcs (>= 1.2.0, < 2.0)
133
+ rspec-support (~> 3.13.0)
134
+ rspec-support (3.13.1)
135
+ rubocop (1.64.1)
136
+ json (~> 2.3)
137
+ language_server-protocol (>= 3.17.0)
138
+ parallel (~> 1.10)
139
+ parser (>= 3.3.0.2)
140
+ rainbow (>= 2.2.2, < 4.0)
141
+ regexp_parser (>= 1.8, < 3.0)
142
+ rexml (>= 3.2.5, < 4.0)
143
+ rubocop-ast (>= 1.31.1, < 2.0)
144
+ ruby-progressbar (~> 1.7)
145
+ unicode-display_width (>= 2.4.0, < 3.0)
146
+ rubocop-ast (1.31.3)
147
+ parser (>= 3.3.1.0)
148
+ rubocop-capybara (2.21.0)
149
+ rubocop (~> 1.41)
150
+ rubocop-discourse (3.8.1)
151
+ activesupport (>= 6.1)
152
+ rubocop (>= 1.59.0)
153
+ rubocop-capybara (>= 2.0.0)
154
+ rubocop-factory_bot (>= 2.0.0)
155
+ rubocop-rails (>= 2.25.0)
156
+ rubocop-rspec (>= 3.0.1)
157
+ rubocop-rspec_rails (>= 2.30.0)
158
+ rubocop-factory_bot (2.26.1)
159
+ rubocop (~> 1.61)
160
+ rubocop-rails (2.25.1)
161
+ activesupport (>= 4.2.0)
162
+ rack (>= 1.1)
163
+ rubocop (>= 1.33.0, < 2.0)
164
+ rubocop-ast (>= 1.31.1, < 2.0)
165
+ rubocop-rspec (3.0.2)
166
+ rubocop (~> 1.61)
167
+ rubocop-rspec_rails (2.30.0)
168
+ rubocop (~> 1.61)
169
+ rubocop-rspec (~> 3, >= 3.0.1)
170
+ ruby-progressbar (1.13.0)
171
+ stringio (3.1.1)
172
+ strscan (3.1.0)
173
+ syntax_tree (6.2.0)
174
+ prettier_print (>= 1.2.0)
175
+ syntax_tree-disable_ternary (1.0.0)
176
+ thor (1.3.1)
177
+ timeout (0.4.1)
178
+ tzinfo (2.0.6)
179
+ concurrent-ruby (~> 1.0)
180
+ unicode-display_width (2.5.0)
181
+ webrick (1.8.1)
182
+ zeitwerk (2.6.16)
183
+
184
+ PLATFORMS
185
+ aarch64-linux
186
+ arm-linux
187
+ arm64-darwin
188
+ x86-linux
189
+ x86_64-darwin
190
+ x86_64-linux
191
+
192
+ DEPENDENCIES
193
+ byebug
194
+ pg
195
+ rack
196
+ rails_failover!
197
+ rake
198
+ redis (~> 4.1)
199
+ rspec
200
+ rubocop-discourse
201
+ syntax_tree
202
+ syntax_tree-disable_ternary
203
+
204
+ BUNDLED WITH
205
+ 2.5.11
data/README.md CHANGED
@@ -107,7 +107,6 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
107
107
  The ActiveRecord failover tests are run against a dummy Rails server. Run the following commands to run the test:
108
108
 
109
109
  1. `make setup_pg`
110
- 2. `make start_pg`
111
110
  3. `bin/rspec active_record`. You may also run the tests with more unicorn workers by adding the `UNICORN_WORKERS` env variable.
112
111
 
113
112
  #### Redis
@@ -60,10 +60,11 @@ module RailsFailover
60
60
 
61
61
  begin
62
62
  connection =
63
- ::ActiveRecord::Base.connection_handler.retrieve_connection(
64
- spec_name,
65
- role: handler_key,
66
- )
63
+ ::ActiveRecord::Base
64
+ .connection_handler
65
+ .retrieve_connection(spec_name, role: handler_key)
66
+ .tap(&:verify!)
67
+
67
68
  connection_active = connection.active?
68
69
  rescue => e
69
70
  logger.debug "#{Process.pid} Connection to server for '#{handler_key} #{spec_name}' failed with '#{e.message}'"
@@ -11,7 +11,7 @@ module RailsFailover
11
11
  app.config.active_record_rails_failover = true
12
12
  ::ActiveSupport.on_load(:active_record) do
13
13
  begin
14
- ::ActiveRecord::Base.connection
14
+ ::ActiveRecord::Base.connection.verify!
15
15
  rescue ::ActiveRecord::NoDatabaseError
16
16
  # Do nothing since database hasn't been created
17
17
  rescue ::PG::Error, ::ActiveRecord::ConnectionNotEstablished
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module RailsFailover
4
- VERSION = "2.1.0"
4
+ VERSION = "2.1.1"
5
5
  end
data/makefile CHANGED
@@ -3,19 +3,8 @@ include redis.mk
3
3
 
4
4
  all: redis
5
5
 
6
- active_record: teardown_dummy_rails_server setup_dummy_rails_server test_active_record
6
+ active_record: start_pg_primary create_test_database stop_pg test_active_record
7
7
 
8
8
  test_active_record:
9
+ @BUNDLE_GEMFILE=./spec/support/dummy_app/Gemfile bundle install --quiet
9
10
  @ACTIVE_RECORD=1 bundle exec rspec --tag type:active_record ${RSPEC_PATH}
10
-
11
- setup_dummy_rails_server:
12
- @cd spec/support/dummy_app && BUNDLE_GEMFILE=Gemfile bundle install --quiet && BUNDLE_GEMFILE=Gemfile RAILS_ENV=production $(BUNDLER_BIN) exec rails db:create db:migrate db:seed
13
-
14
- start_dummy_rails_server:
15
- @cd spec/support/dummy_app && BUNDLE_GEMFILE=Gemfile SECRET_KEY_BASE=somekey bundle exec unicorn -c config/unicorn.conf.rb -D -E production
16
-
17
- stop_dummy_rails_server:
18
- @kill -TERM $(shell cat spec/support/dummy_app/tmp/pids/unicorn.pid)
19
-
20
- teardown_dummy_rails_server:
21
- @cd spec/support/dummy_app && (! (bundle check > /dev/null 2>&1) || BUNDLE_GEMFILE=Gemfile DISABLE_DATABASE_ENVIRONMENT_CHECK=1 RAILS_ENV=production $(BUNDLER_BIN) exec rails db:drop)
data/postgresql.mk CHANGED
@@ -1,9 +1,9 @@
1
1
  PG_BIN_DIR := $(shell pg_config --bindir)
2
2
  PWD := $(shell pwd)
3
- PG_PRIMARY_DIR := $(PWD)/tmp/primary
3
+ PG_PRIMARY_DIR := /tmp/primary
4
4
  PG_PRIMARY_DATA_DIR := $(PG_PRIMARY_DIR)/data
5
5
  PG_PRIMARY_RUN_DIR := $(PG_PRIMARY_DIR)/run
6
- PG_REPLICA_DIR := $(PWD)/tmp/replica
6
+ PG_REPLICA_DIR := /tmp/replica
7
7
  PG_REPLICA_DATA_DIR := $(PG_REPLICA_DIR)/data
8
8
  PG_REPLICA_RUN_DIR := $(PG_REPLICA_DIR)/run
9
9
  PG_PRIMARY_PORT := 5434
@@ -14,11 +14,14 @@ PG_REPLICATION_SLOT_NAME := replication
14
14
 
15
15
  setup_pg: init_primary start_pg_primary setup_primary init_replica stop_pg_primary
16
16
 
17
+ create_test_database:
18
+ @$(PG_BIN_DIR)/psql -p $(PG_PRIMARY_PORT) -h $(PG_PRIMARY_RUN_DIR) -d postgres --quiet -c "DROP DATABASE IF EXISTS test;"
19
+ @$(PG_BIN_DIR)/psql -p $(PG_PRIMARY_PORT) -h $(PG_PRIMARY_RUN_DIR) -d postgres --quiet -c "CREATE DATABASE test;"
20
+
17
21
  setup_primary:
18
22
  @$(PG_BIN_DIR)/psql -p $(PG_PRIMARY_PORT) -h $(PG_PRIMARY_RUN_DIR) -d postgres -c "CREATE USER $(PG_REPLICATION_USER) WITH REPLICATION ENCRYPTED PASSWORD '$(PG_REPLICATION_PASSWORD)';"
19
23
  @$(PG_BIN_DIR)/psql -p $(PG_PRIMARY_PORT) -h $(PG_PRIMARY_RUN_DIR) -d postgres -c "SELECT * FROM pg_create_physical_replication_slot('$(PG_REPLICATION_SLOT_NAME)');"
20
24
  @$(PG_BIN_DIR)/psql -p $(PG_PRIMARY_PORT) -h $(PG_PRIMARY_RUN_DIR) -d postgres -c "CREATE USER test;"
21
- @$(PG_BIN_DIR)/psql -p $(PG_PRIMARY_PORT) -h $(PG_PRIMARY_RUN_DIR) -d postgres -c "CREATE DATABASE test;"
22
25
 
23
26
  start_pg: start_pg_primary start_pg_replica
24
27
 
@@ -36,19 +39,36 @@ init_replica:
36
39
  @chmod 0700 $(PG_REPLICA_DATA_DIR)
37
40
 
38
41
  start_pg_primary:
39
- @$(PG_BIN_DIR)/pg_ctl --silent --log /dev/null -w -D $(PG_PRIMARY_DATA_DIR) -o "-p $(PG_PRIMARY_PORT)" -o "-k $(PG_PRIMARY_RUN_DIR)" start
42
+ @if [ ! -d "$(PG_PRIMARY_DATA_DIR)" ] || ! $(PG_BIN_DIR)/pg_ctl status -D $(PG_PRIMARY_DATA_DIR) > /dev/null 2>&1; then \
43
+ $(PG_BIN_DIR)/pg_ctl --silent --log /dev/null -w -D $(PG_PRIMARY_DATA_DIR) -o "-p $(PG_PRIMARY_PORT)" -o "-k $(PG_PRIMARY_RUN_DIR)" start; \
44
+ while ! $(PG_BIN_DIR)/pg_ctl status -D $(PG_PRIMARY_DATA_DIR) > /dev/null 2>&1; do \
45
+ sleep 1; \
46
+ done; \
47
+ fi
40
48
 
41
49
  start_pg_replica:
42
- @$(PG_BIN_DIR)/pg_ctl --silent --log /dev/null -w -D $(PG_REPLICA_DATA_DIR) -o "-p $(PG_REPLICA_PORT)" -o "-k $(PG_REPLICA_RUN_DIR)" start
43
-
44
- restart_pg_primary:
45
- @$(PG_BIN_DIR)/pg_ctl --silent --log /dev/null -w -D $(PG_PRIMARY_DATA_DIR) -o "-p $(PG_PRIMARY_PORT)" -o "-k $(PG_PRIMARY_RUN_DIR)" restart
50
+ @if [ ! -d "$(PG_REPLICA_DATA_DIR)" ] || ! $(PG_BIN_DIR)/pg_ctl status -D $(PG_REPLICA_DATA_DIR) > /dev/null 2>&1; then \
51
+ $(PG_BIN_DIR)/pg_ctl --silent --log /dev/null -w -D $(PG_REPLICA_DATA_DIR) -o "-p $(PG_REPLICA_PORT)" -o "-k $(PG_REPLICA_RUN_DIR)" start; \
52
+ while ! $(PG_BIN_DIR)/pg_ctl status -D $(PG_REPLICA_DATA_DIR) > /dev/null 2>&1; do \
53
+ sleep 1; \
54
+ done; \
55
+ fi
46
56
 
47
57
  stop_pg_primary:
48
- @$(PG_BIN_DIR)/pg_ctl --silent --log /dev/null -w -D $(PG_PRIMARY_DATA_DIR) -o "-p $(PG_PRIMARY_PORT)" -o "-k $(PG_PRIMARY_RUN_DIR)" stop
58
+ @if [ -d "$(PG_PRIMARY_DATA_DIR)" ] && $(PG_BIN_DIR)/pg_ctl status -D $(PG_PRIMARY_DATA_DIR) > /dev/null 2>&1; then \
59
+ $(PG_BIN_DIR)/pg_ctl --silent --log /dev/null -w -D $(PG_PRIMARY_DATA_DIR) -o "-p $(PG_PRIMARY_PORT)" -o "-k $(PG_PRIMARY_RUN_DIR)" stop; \
60
+ while $(PG_BIN_DIR)/pg_ctl status -D $(PG_PRIMARY_DATA_DIR) > /dev/null 2>&1; do \
61
+ sleep 1; \
62
+ done; \
63
+ fi
49
64
 
50
65
  stop_pg_replica:
51
- @$(PG_BIN_DIR)/pg_ctl --silent --log /dev/null -w -D $(PG_REPLICA_DATA_DIR) -o "-p $(PG_REPLICA_PORT)" -o "-k $(PG_REPLICA_RUN_DIR)" stop
66
+ @if [ -d "$(PG_REPLICA_DATA_DIR)" ] && $(PG_BIN_DIR)/pg_ctl status -D $(PG_REPLICA_DATA_DIR) > /dev/null 2>&1; then \
67
+ $(PG_BIN_DIR)/pg_ctl --silent --log /dev/null -w -D $(PG_REPLICA_DATA_DIR) -o "-p $(PG_REPLICA_PORT)" -o "-k $(PG_REPLICA_RUN_DIR)" stop; \
68
+ while $(PG_BIN_DIR)/pg_ctl status -D $(PG_REPLICA_DATA_DIR) > /dev/null 2>&1; do \
69
+ sleep 1; \
70
+ done; \
71
+ fi
52
72
 
53
73
  cleanup_pg:
54
74
  @rm -rf $(PG_PRIMARY_DIR) $(PG_REPLICA_DIR)
@@ -27,11 +27,11 @@ Gem::Specification.new do |spec|
27
27
  spec.add_dependency "railties", ">= 6.1", "< 8.0"
28
28
  spec.add_dependency "concurrent-ruby"
29
29
 
30
- spec.add_development_dependency "rake", "~> 12.0"
30
+ spec.add_development_dependency "rake"
31
31
  spec.add_development_dependency "redis", "~> 4.1"
32
- spec.add_development_dependency "pg", "~> 1.2"
32
+ spec.add_development_dependency "pg"
33
33
  spec.add_development_dependency "rack"
34
- spec.add_development_dependency "rspec", "~> 3.0"
34
+ spec.add_development_dependency "rspec"
35
35
  spec.add_development_dependency "byebug"
36
36
  spec.add_development_dependency "rubocop-discourse"
37
37
  spec.add_development_dependency "syntax_tree"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails_failover
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.0
4
+ version: 2.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alan Tan
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-05-29 00:00:00.000000000 Z
11
+ date: 2024-07-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord
@@ -68,16 +68,16 @@ dependencies:
68
68
  name: rake
69
69
  requirement: !ruby/object:Gem::Requirement
70
70
  requirements:
71
- - - "~>"
71
+ - - ">="
72
72
  - !ruby/object:Gem::Version
73
- version: '12.0'
73
+ version: '0'
74
74
  type: :development
75
75
  prerelease: false
76
76
  version_requirements: !ruby/object:Gem::Requirement
77
77
  requirements:
78
- - - "~>"
78
+ - - ">="
79
79
  - !ruby/object:Gem::Version
80
- version: '12.0'
80
+ version: '0'
81
81
  - !ruby/object:Gem::Dependency
82
82
  name: redis
83
83
  requirement: !ruby/object:Gem::Requirement
@@ -96,16 +96,16 @@ dependencies:
96
96
  name: pg
97
97
  requirement: !ruby/object:Gem::Requirement
98
98
  requirements:
99
- - - "~>"
99
+ - - ">="
100
100
  - !ruby/object:Gem::Version
101
- version: '1.2'
101
+ version: '0'
102
102
  type: :development
103
103
  prerelease: false
104
104
  version_requirements: !ruby/object:Gem::Requirement
105
105
  requirements:
106
- - - "~>"
106
+ - - ">="
107
107
  - !ruby/object:Gem::Version
108
- version: '1.2'
108
+ version: '0'
109
109
  - !ruby/object:Gem::Dependency
110
110
  name: rack
111
111
  requirement: !ruby/object:Gem::Requirement
@@ -124,16 +124,16 @@ dependencies:
124
124
  name: rspec
125
125
  requirement: !ruby/object:Gem::Requirement
126
126
  requirements:
127
- - - "~>"
127
+ - - ">="
128
128
  - !ruby/object:Gem::Version
129
- version: '3.0'
129
+ version: '0'
130
130
  type: :development
131
131
  prerelease: false
132
132
  version_requirements: !ruby/object:Gem::Requirement
133
133
  requirements:
134
- - - "~>"
134
+ - - ">="
135
135
  - !ruby/object:Gem::Version
136
- version: '3.0'
136
+ version: '0'
137
137
  - !ruby/object:Gem::Dependency
138
138
  name: byebug
139
139
  requirement: !ruby/object:Gem::Requirement
@@ -205,6 +205,7 @@ files:
205
205
  - CHANGELOG.md
206
206
  - CODE_OF_CONDUCT.md
207
207
  - Gemfile
208
+ - Gemfile.lock
208
209
  - LICENSE.txt
209
210
  - README.md
210
211
  - Rakefile
@@ -244,7 +245,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
244
245
  - !ruby/object:Gem::Version
245
246
  version: '0'
246
247
  requirements: []
247
- rubygems_version: 3.5.9
248
+ rubygems_version: 3.5.11
248
249
  signing_key:
249
250
  specification_version: 4
250
251
  summary: Failover for ActiveRecord and Redis