mongolly 0.2.17 → 0.2.18

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
  SHA1:
3
- metadata.gz: 1c53040071fac994e338d2b6cbab89de76f004ed
4
- data.tar.gz: dc8ca819db261832acffdeb97befdc2092422147
3
+ metadata.gz: c7843a63749c6a2bc5d71ed51459fc3a3410aa89
4
+ data.tar.gz: 7777cd1c4f38c0b34673720b767f8b013ff49ef8
5
5
  SHA512:
6
- metadata.gz: 800b11bcb79bd9843b4df63712de6f2534f0e03e16f767ae0fe1bdfec1ac338e5b9d3cdaad94c4f99353484dc1926e32f1c7d7b356dae8a90d80b758644dd95c
7
- data.tar.gz: 1f956b32c4560a2a160ee63d7b05cb0db7bcfddaf6837bdfccae04cbab2cb29347d9d55c0302a4ca23e2592622d902caefca6cc1d8fdaff9580c321d71ce07bb
6
+ metadata.gz: bc764d4b1fdd5bf5b111a9316a2e03e48de60e8198d5a4e5ebbc77e31275fe90d01b2d516a649a9934cf235a10789485d611a20f5b45884b63a093ffad739adf
7
+ data.tar.gz: 8799ae59ffcb7c43bd2a840cf9849e90e70c3efa337d07543829abd83a83f0232b3fdbd40eee9ce1d5393614ddb2a0fd6a6030b899b5cf43890dcd1a08884274
@@ -9,6 +9,9 @@ end
9
9
  class UnlockFailException < StandardError
10
10
  end
11
11
 
12
+ class UnxpectedUnlockException < StandardError
13
+ end
14
+
12
15
  class Mongo::MongoClient
13
16
  MAX_DISABLE_BALANCER_WAIT = 60 * 8 # 8 Minutes
14
17
  MAX_UNLOCK_RETRIES = 3
@@ -201,9 +204,14 @@ class Mongo::MongoClient
201
204
 
202
205
  private
203
206
 
204
- def strong_unlock!
207
+ def strong_unlock!(aggressive: false)
205
208
  @mongolly_logger.debug "Unlocking database..."
206
- return if @mongolly_dry_run || !locked?
209
+ return if @mongolly_dry_run
210
+ if !locked?
211
+ return if !aggressive
212
+ raise UnxpectedUnlockException
213
+ end
214
+ return if !locked? && !aggressive
207
215
  retries ||= 0
208
216
  # {"info"=>"unlock completed", "ok"=>1.0}
209
217
  response = unlock!
@@ -223,7 +231,7 @@ class Mongo::MongoClient
223
231
  # This prevents a subclassed replica set from still acting against the
224
232
  # primary
225
233
  if options[:strict_connection] && (self.host != host || self.port.to_i != port.to_i)
226
- return Mongo::MongoClient.new(host, port.to_i, slave_ok: true).snapshot_ebs(options)
234
+ return Mongo::MongoClient.new(host, port.to_i, slave_ok: true, op_timeout: @op_timeout).snapshot_ebs(options)
227
235
  end
228
236
 
229
237
  instance = @ec2.instances.find_from_address(host, port)
@@ -1,3 +1,3 @@
1
1
  module Mongolly
2
- VERSION = "0.2.17".freeze
2
+ VERSION = "0.2.18".freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mongolly
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.17
4
+ version: 0.2.18
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Saffitz