zeevex_cluster 0.3.4 → 0.3.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 +8 -8
- data/lib/zeevex_cluster/coordinator/mysql.rb +7 -3
- data/lib/zeevex_cluster/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
NDJhZTNkZTM5ZGJkNDcxNjQ4Njg2YWMzY2QyZDlhOWUxMGFiNmQyNg==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
OWY3NDQwMjljNDRhNDNlMzZmMDRjYzQwZTMwNDA4NDdmYjU3MzkxYQ==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
YjE2NmEyZjI1ZTQ0ZmYxYTA5N2FhYTFlZDZkNmU3MmJiMzVjMzJlN2I4ODMy
|
10
|
+
Y2M5MmZkZGZhZWM5ODFiMmM4ZGFkNTQ5N2FlNTc4NjQ3NGY2Y2UwNjI0MjY0
|
11
|
+
NzExOWRiOTQzMmYwYmMwNDY5ZTMzN2VmM2M2OTVkNGMyNWVhODY=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
Y2RmNjkzYzI4YWZkZjkxOWE3NTgxMzBlYzQ3Njc2MTliMDYxOThmMjM0MzA2
|
14
|
+
YjljY2MzYWZlNWZkOGE2NzE2YTk5MDhkMWYwNzI3YWY4YzRkMTk4YjVhNmZj
|
15
|
+
MzJkNDY0OGUxMjJiNDc0YmEzMDIzZjg4MzA5NDM1N2Y4NTk4MTc=
|
@@ -285,7 +285,7 @@ module ZeevexCluster::Coordinator
|
|
285
285
|
|
286
286
|
def clear_expired_rows
|
287
287
|
statement = %{DELETE FROM #@table WHERE #{qcol 'expires_at'} < #{qnow} and #{qcol 'namespace'} = #{qval @namespace};}
|
288
|
-
@client.query statement
|
288
|
+
@client.query statement, _mysql_query_options
|
289
289
|
true
|
290
290
|
rescue ::Mysql2::Error
|
291
291
|
log_exception($!, statement)
|
@@ -294,13 +294,18 @@ module ZeevexCluster::Coordinator
|
|
294
294
|
logger.error %{Unhandled error in query: #{$!.inspect}\nstatement=[#{statement}]\n#{$!.backtrace.join("\n")}}
|
295
295
|
end
|
296
296
|
|
297
|
+
def _mysql_query_options
|
298
|
+
{as: :hash, symbolize_keys: true}
|
299
|
+
end
|
300
|
+
|
297
301
|
#
|
298
302
|
# chokepoint for *most* queries issued to MySQL, except the one from `clear_expired_rows` as we call it.
|
299
303
|
#
|
300
304
|
# returns a hash containing values returned from mysql2 API
|
301
305
|
#
|
302
306
|
def query(statement, options = {})
|
303
|
-
|
307
|
+
options = _mysql_query_options.merge(options)
|
308
|
+
unless options.delete(:ignore_expiration)
|
304
309
|
clear_expired_rows
|
305
310
|
end
|
306
311
|
logger.debug "[#{statement}]"
|
@@ -313,7 +318,6 @@ module ZeevexCluster::Coordinator
|
|
313
318
|
logger.error %{Unhandled error in query: #{$!.inspect}\nstatement=[#{statement}]\n#{$!.backtrace.join("\n")}}
|
314
319
|
raise
|
315
320
|
end
|
316
|
-
|
317
321
|
#
|
318
322
|
# extract a hash with a subset of keys
|
319
323
|
#
|