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 +4 -4
- data/lib/mongolly/extensions/mongo/mongo_client.rb +11 -3
- data/lib/mongolly/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c7843a63749c6a2bc5d71ed51459fc3a3410aa89
|
4
|
+
data.tar.gz: 7777cd1c4f38c0b34673720b767f8b013ff49ef8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
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)
|
data/lib/mongolly/version.rb
CHANGED