activerecord-trilogy-failover 0.1.0 → 0.1.1

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: 5e6f84d43760ea21937b7eb3818b3c117e2aa5a43716568dfb7c800fbff16a40
4
- data.tar.gz: cc3629c63028c92df3f3285dbc3f219c3fa9c00df61944d6250aaf93460b7e77
3
+ metadata.gz: 94046324e20494dbb4a8661272db0f3ccb87d74b4c64f022a5789e5bd8ccb37a
4
+ data.tar.gz: dfa11a6a53365823151dbf92277aa8bfd251578ffdf542aebbd62417f47cde27
5
5
  SHA512:
6
- metadata.gz: 675583f7a32b1253ce365502761e838950393fd529ca438ec7cefca5846cd62b702dff2f7fa74f89bc437e1addde5e4625c0c4f6163a46d1e73520a2cee2e32e
7
- data.tar.gz: 5a037835f24cc566a69a954019d190c6a875d67e2e69c8d1e9277662bf7b8332b1bcf568551f0d2e5d21c37914942d2c01697336517df0845c801c5c856032eb
6
+ metadata.gz: d4c5f81d0f0f665dc2bd9d3f675dd97a426ac94d78fe9e5e5e82a642f17409a92483223996a5e8451a93849ae973f6732f2c1bdfa6ec03e0aae657df92d43fe0
7
+ data.tar.gz: e1d29a266e17c7592b36225ec2aadbdf5b31c90f06f4168ffe73dc2287da6138d36cc4e4a181e082c7f5e120baa361bc50ff6004cd21903c2290e8f92ea22a91
data/README.md CHANGED
@@ -22,7 +22,7 @@ This is the correct behavior — writes should not be silently retried.
22
22
  Add to your Gemfile:
23
23
 
24
24
  ```ruby
25
- gem "activerecord-trilogy-failover", github: "riseshia/activerecord-trilogy-failover"
25
+ gem "activerecord-trilogy-failover"
26
26
  ```
27
27
 
28
28
  ## Usage
@@ -39,17 +39,6 @@ ActiveRecord::ConnectionAdapters::TrilogyAdapter.prepend(
39
39
  )
40
40
  ```
41
41
 
42
- ### database.yml tuning
43
-
44
- Rails' built-in retry settings work with this gem:
45
-
46
- ```yaml
47
- production:
48
- adapter: trilogy
49
- connection_retries: 2 # default: 1
50
- retry_deadline: 5 # seconds, default: none
51
- ```
52
-
53
42
  ## Compatibility
54
43
 
55
44
  - Ruby >= 3.2
@@ -10,6 +10,11 @@ module ActiveRecordTrilogyFailover
10
10
 
11
11
  def translate_exception(exception, message:, sql:, binds:)
12
12
  if read_only_error?(exception)
13
+ # Close the underlying TCP connection to prevent pool reuse.
14
+ # A read-only server still accepts ROLLBACK, SELECT 1, and ping,
15
+ # so without closing, the connection passes verify! and stays in the pool.
16
+ @raw_connection&.close rescue nil
17
+
13
18
  return ActiveRecord::ConnectionFailed.new(
14
19
  "#{exception.class}: #{exception.message}",
15
20
  connection_pool: @pool
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ActiveRecordTrilogyFailover
4
- VERSION = "0.1.0"
4
+ VERSION = "0.1.1"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: activerecord-trilogy-failover
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Shia