sqeduler 0.3.1 → 0.3.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
  SHA1:
3
- metadata.gz: 6bf402d8f9a9fa71478dbaf7d240c132e0eebb07
4
- data.tar.gz: b372b39855ad6c9c1cd65815cb3b9b1215248bf7
3
+ metadata.gz: abf3832836e43f9513299831abcce9bc67551ed1
4
+ data.tar.gz: eee3fc43d7e4d7aa106e7ff244f8029932feda94
5
5
  SHA512:
6
- metadata.gz: 9b4352281ee3d6bb49b2c802e6d254f02c6d89ae3224149877bc2db6cd35ff60ac4a0201b824aef0b37b6825fd6e280d0a988c5993085c75e7a17440bb17905a
7
- data.tar.gz: 7c1fdb476cd81993adb418188d3fb6cec45f625c4a96ac842ff5fbe92cc87d4109aac4e30cbb45d27ff45a7bb1e215691769c82647bdf5a2702b215565ddd4d3
6
+ metadata.gz: e984434cc1cd0c5fbe44f34b85a1fa75d520d2de2e635a0ba3e848ad195dcc6015e0cf00495e2cc41fe30fdfcb3988cbf2e7aac7a5c24d547f6c6a95dc3d998d
7
+ data.tar.gz: c5cc39b2699fb6da450f3c8dd32c4da5eadd11775820b3420af024d1376598ca51f09a4fae376b60ef6761cb75fe3323a411ecebfcf7ef0a51b4df7cf582e9a8
data/CHANGES.md CHANGED
@@ -1,3 +1,8 @@
1
+ ### 0.3.2 / 2016-03-10
2
+
3
+ * Fixed lock refresher failing to lock properly for exclusive runs
4
+ * Added debug logs for lock refresher
5
+
1
6
  ### 0.3.1 / 2016-02-17
2
7
 
3
8
  * Fixed lock refresh checking timeout rather than expiration for finding eligible jobs
@@ -17,9 +17,16 @@ module Sqeduler
17
17
  @maintainer_thread ||= Thread.new do
18
18
  loop do
19
19
  begin
20
- synchronize
20
+ if redis_lock.lock
21
+ begin
22
+ synchronize
23
+ ensure
24
+ redis_lock.unlock
25
+ end
26
+ end
27
+
21
28
  rescue => ex
22
- Service.logger.error "[SQEDULER LOCK MAINTAINER] #{ex.class}, #{ex.message}"
29
+ Service.logger.error "[#{self.class}] #{ex.class}, #{ex.message}"
23
30
  end
24
31
 
25
32
  sleep RUN_INTERVAL + rand(RUN_JITTER)
@@ -30,10 +37,6 @@ module Sqeduler
30
37
  private
31
38
 
32
39
  def synchronize
33
- # Not great, but finding our identity in Sidekiq is a pain, and we already have locks in Sqeduler.
34
- # Easier to just try and grab a lock each time and whichever server wins gets to do it.
35
- return unless redis_lock.send(:take_lock)
36
-
37
40
  now = Time.now.to_i
38
41
 
39
42
  Service.redis_pool do |redis|
@@ -51,6 +54,9 @@ module Sqeduler
51
54
  # We don't have to worry about atomic operations or anything like that.
52
55
  # If the job finishes in the interim and deletes the key nothing will happen.
53
56
  redis.expire(lock_key, klass.synchronize_jobs_expiration)
57
+
58
+ Service.logger.debug "[#{self.class}] Refreshing lock on '#{lock_key}" \
59
+ "to #{klass.synchronize_jobs_expiration} seconds"
54
60
  end
55
61
  end
56
62
  end
@@ -64,10 +70,12 @@ module Sqeduler
64
70
  if klass.respond_to?(:synchronize_jobs_mode)
65
71
  # We only care about exclusive jobs that are long running
66
72
  if klass.synchronize_jobs_mode == :one_at_a_time && klass.synchronize_jobs_expiration >= RUN_INTERVAL
73
+ Service.logger.debug "[#{self.class}] Adding #{class_name} to the whitelist of classes that have locks"
67
74
  return @class_with_locks[class_name] = klass
68
75
  end
69
76
  end
70
77
 
78
+ Service.logger.debug "[#{self.class}] Adding #{class_name} to the blacklist of classes that have locks"
71
79
  @class_with_locks[class_name] = false
72
80
  end
73
81
 
@@ -1,4 +1,4 @@
1
1
  # encoding: utf-8
2
2
  module Sqeduler
3
- VERSION = "0.3.1".freeze
3
+ VERSION = "0.3.2".freeze
4
4
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sqeduler
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ version: 0.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jared Jenkins
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-02-18 00:00:00.000000000 Z
11
+ date: 2016-03-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sidekiq