rails_failover 0.6.4 → 0.6.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 651969085a16547763a2df77d40285f300c602fea51089989ec4b6fe62832c3d
4
- data.tar.gz: aed0094cc23da42f1870ace6b94badc64493f2bf85053ab387bd22919c5e939a
3
+ metadata.gz: 45afa97c24a3c8f4fac5c74a52eabbf0d06b9f7ad037a76b18bee05875b4f374
4
+ data.tar.gz: e57ffc9182a9b2f4145c04d4f921bcd79aee3edfec5dedacac2fb6f23d39dc9d
5
5
  SHA512:
6
- metadata.gz: b9310d55228dee7660d2e616349b014652c5eb5559b5db0f85a915500dfdde693843d6f9c1abb3195749bb7d7b4cfe1ca3341deedb1e8b68b86c7d14c567485f
7
- data.tar.gz: 81bb776dac713ab01d1833346658be050488b3c24687bd4c603b3e47b3c444e83bb709074576e4a796da637a449914e6916420b505176a022fd51b92b6a42115
6
+ metadata.gz: 0ee4ae4e79e17881a49f77711b5f13f301977d67cd177f8d16296cff93c0aea63b9151f235acfde87afaae14f6215840fbb3efb6024a98b59c14454b88705356
7
+ data.tar.gz: 48d815e482d5b6b92316431bda654709f3049647292c4a4d9b8a6a075086be2e23b12cceed898d07e10f729bc85217aa395521a49ffd1c4baad63927ed938963
@@ -6,6 +6,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
6
6
 
7
7
  ## [Unreleased]
8
8
 
9
+ ## [0.6.5] - 2020-12-16
10
+
11
+ - FIX: Catch exceptions that are not intercepted by `ActionDispatch::DebugExceptions`.
12
+
9
13
  ## [0.6.4] - 2020-12-09
10
14
 
11
15
  - FIX: Handle the case when the replica is set equal to the primary
@@ -31,7 +35,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
31
35
 
32
36
  - FEATURE: Add primaries_down_count function to failover handlers
33
37
 
34
- This is intended for consumption by monitoring systems (e.g. the Discourse prometheus exporter)
38
+ This is intended for consumption by monitoring systems (e.g. the Discourse prometheus exporter)
35
39
 
36
40
  ## [0.5.9] - 2020-11-06
37
41
  - FIX: Ignore errors from the redis socket shutdown call
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- rails_failover (0.6.4)
4
+ rails_failover (0.6.5)
5
5
  activerecord (~> 6.0)
6
6
  concurrent-ruby
7
7
  railties (~> 6.0)
@@ -14,10 +14,17 @@ module RailsFailover
14
14
  end
15
15
 
16
16
  def self.handle(request, exception)
17
+ verify_primary(
18
+ exception,
19
+ request.env[Middleware::WRITING_ROLE_HEADER]
20
+ )
21
+ end
22
+
23
+ def self.verify_primary(exception, writing_role)
17
24
  exception = resolve_cause(exception)
18
25
 
19
26
  if adapter_errors.any? { |error| exception.is_a?(error) }
20
- Handler.instance.verify_primary(request.env[Middleware::WRITING_ROLE_HEADER])
27
+ Handler.instance.verify_primary(writing_role)
21
28
  end
22
29
  end
23
30
 
@@ -61,6 +68,9 @@ module RailsFailover
61
68
  env[WRITING_ROLE_HEADER] = writing_role
62
69
  @app.call(env)
63
70
  end
71
+ rescue => e
72
+ Interceptor.verify_primary(e, writing_role) if writing_role
73
+ raise e
64
74
  end
65
75
 
66
76
  private
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module RailsFailover
4
- VERSION = "0.6.4"
4
+ VERSION = "0.6.5"
5
5
  end
data/makefile CHANGED
@@ -9,7 +9,7 @@ test_active_record:
9
9
  @ACTIVE_RECORD=1 bundle exec rspec --tag type:active_record ${RSPEC_PATH}
10
10
 
11
11
  setup_dummy_rails_server:
12
- @cd spec/support/dummy_app && bundle install --quiet --without test --without development && yarn install && RAILS_ENV=production $(BUNDLER_BIN) exec rails db:create db:migrate db:seed
12
+ @cd spec/support/dummy_app && bundle install --quiet && yarn install && RAILS_ENV=production $(BUNDLER_BIN) exec rails db:create db:migrate db:seed
13
13
 
14
14
  start_dummy_rails_server:
15
15
  @cd spec/support/dummy_app && BUNDLE_GEMFILE=Gemfile UNICORN_WORKERS=5 SECRET_KEY_BASE=somekey bundle exec unicorn -c config/unicorn.conf.rb -D -E production
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: 0.6.4
4
+ version: 0.6.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alan Tan
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-12-09 00:00:00.000000000 Z
11
+ date: 2020-12-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord
@@ -52,7 +52,7 @@ dependencies:
52
52
  - - ">="
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
- description:
55
+ description:
56
56
  email:
57
57
  - tgx@discourse.org
58
58
  executables: []
@@ -87,11 +87,11 @@ files:
87
87
  - postgresql.mk
88
88
  - rails_failover.gemspec
89
89
  - redis.mk
90
- homepage:
90
+ homepage:
91
91
  licenses:
92
92
  - MIT
93
93
  metadata: {}
94
- post_install_message:
94
+ post_install_message:
95
95
  rdoc_options: []
96
96
  require_paths:
97
97
  - lib
@@ -106,8 +106,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
106
106
  - !ruby/object:Gem::Version
107
107
  version: '0'
108
108
  requirements: []
109
- rubygems_version: 3.0.3
110
- signing_key:
109
+ rubygems_version: 3.1.4
110
+ signing_key:
111
111
  specification_version: 4
112
112
  summary: Failover for ActiveRecord and Redis
113
113
  test_files: []