resilient_reads 0.1.1 → 0.1.2

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: 4bbb75d50de2bb59656b1f4e944a3187c01c16c36fb02a21c30a7c3dc7eee953
4
- data.tar.gz: 6474b24d88c87626dc7d35a2b080ea06d603d0a4071733122e73273cd2143404
3
+ metadata.gz: e9ca59bd308356c26b2f833ae03fff90e58733e58e1c972c2eed7f84997e1f72
4
+ data.tar.gz: bb1eeee56723a1856ec9204b8cd3a8e521fc332d8ab26b0a3c68a538910726b4
5
5
  SHA512:
6
- metadata.gz: a6c3241dd6d5a240262da022d8f53a5946d54d15c1efb1d47e3d23fb645db3d4d58ebcd5713ace5700e0d733a1171188692f3ffe00819fa79d7a43bed6260f4c
7
- data.tar.gz: 82e30dc4fcbffa079390b60fa4e2f35cfb68025ea7fc88a33896ce5aed3faabc1b094d52cd558c017e7de3fc64bb017b41c6217fdb0709295a0a1b9946db4331
6
+ metadata.gz: c443fc6041771447152fbf30c42df9e6aabfbd1a626da0454a102d320c52c2da687e6d9ee196e9caf03a35057de7eb91e1233b785c474c3dc14034962b15b4b1
7
+ data.tar.gz: 59acea745a3fc0e690607fca23f39e342ccf8a1350a813267336f16491609ea16e10d7fb5739278a45abcd888718a5f0352e760e59c414bc16fcf7f730fafca6
@@ -45,9 +45,8 @@ module ResilientReads
45
45
  end
46
46
 
47
47
  def self.lag_for_mysql(conn)
48
- result = conn.execute("SHOW SLAVE STATUS")
48
+ result = conn.execute("SHOW REPLICA STATUS")
49
49
  # MySQL 8.0.22+ uses SHOW REPLICA STATUS
50
- result = conn.execute("SHOW REPLICA STATUS") if result.respond_to?(:count) && result.count == 0
51
50
 
52
51
  row = if result.respond_to?(:first)
53
52
  result.first
@@ -58,11 +57,12 @@ module ResilientReads
58
57
  return nil unless row
59
58
 
60
59
  # Seconds_Behind_Master / Seconds_Behind_Source (MySQL 8.0.22+)
61
- lag = if row.is_a?(Hash)
62
- row["Seconds_Behind_Master"] || row["Seconds_Behind_Source"]
63
- elsif row.respond_to?(:[])
64
- row["Seconds_Behind_Master"] || row["Seconds_Behind_Source"]
65
- end
60
+ lag =
61
+ if row.is_a?(Hash)
62
+ row["Seconds_Behind_Source"]
63
+ elsif row.respond_to?(:[])
64
+ row["Seconds_Behind_Source"]
65
+ end
66
66
 
67
67
  lag&.to_f
68
68
  rescue => e
@@ -1,3 +1,3 @@
1
1
  module ResilientReads
2
- VERSION = "0.1.1"
2
+ VERSION = "0.1.2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: resilient_reads
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jamie Puckett