sidecloq 0.3.1 → 0.3.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: dbb14d2cb9a6f7f0bffae45cd3ec7f00c8a2ad13
4
- data.tar.gz: c44a7e5b308559bfb3c5d2bf10c108de1e9ff090
3
+ metadata.gz: b41bfb4239c49401c7770406179fa1f540b7c02f
4
+ data.tar.gz: fe0442e1e48ab22235e87730805bf66857187def
5
5
  SHA512:
6
- metadata.gz: f613f8c63b1d6e3bd87682e740a1e56fdf2796be6b5488967cda62fbd5f9ce417382ca42ee3ae7ac3b3a3975636b13a03c518d80eee59c47e20ac245565cb2ea
7
- data.tar.gz: 69f054480ede7d3318804bbff1d9b0b59c46b40210fa2cac10aea2691fb8d4912027537f48599c0803b4015f75b716830adbea0af39878efc4d77d4e2b0a9f0e
6
+ metadata.gz: 23ac57a675494dcbd4c165e2be9926fde24705b6f0186cf5e8c72f8bb4f12f107bd1d8bab6f03e8e6346dfab67a486057ce57a0c648edf0339ea6d539c758025
7
+ data.tar.gz: ef479271fb90cebc3019de4ca86a1a3007689b2cdaba584c08a3bb25ab45a6d3d554fa101c6c24b136342def3d037dd54f4a4676ae1cfeea22bdc1586a9d3470
data/README.md CHANGED
@@ -71,9 +71,17 @@ the above configuration block).
71
71
  ```yaml
72
72
  my_scheduled_job: # a unique name for this schedule
73
73
  class: Jobs::DoWork # the job class
74
+ args: [100] # (optional) set of arguments
74
75
  cron: "* * * * *" # cron formatted schedule
75
76
  queue: "queue_name" # Sidekiq queue for job
76
77
 
78
+ my_scheduled_job_with_args:
79
+ class: Jobs::WorkerWithArgs
80
+ args:
81
+ batch_size: 100
82
+ cron: "1 1 * * *"
83
+ queue: "queue_name"
84
+
77
85
  my_other_scheduled_job:
78
86
  class: Jobs::AnotherClassName
79
87
  cron: "1 1 * * *"
@@ -13,6 +13,7 @@ module Sidecloq
13
13
  @check_interval = options[:check_interval] || 15
14
14
  @lock_manager = Redlock::Client.new([@redis])
15
15
  @obtained_lock = Concurrent::Event.new
16
+ @lock = nil
16
17
  end
17
18
 
18
19
  # blocks until lock is obtained, then yields
@@ -51,7 +52,11 @@ module Sidecloq
51
52
 
52
53
  def try_to_get_or_refresh_lock
53
54
  # redlock is in ms, not seconds
54
- @lock = @lock_manager.lock(@key, @ttl * 1000, extend: @lock)
55
+ if @lock
56
+ @lock = @lock_manager.lock(@key, @ttl * 1000, extend: @lock)
57
+ else
58
+ @lock = @lock_manager.lock(@key, @ttl * 1000)
59
+ end
55
60
  @obtained_lock.set if @lock
56
61
  logger.debug("Leader lock #{'not ' unless @lock}held")
57
62
  @lock
@@ -1,3 +1,3 @@
1
1
  module Sidecloq
2
- VERSION = '0.3.1'
2
+ VERSION = '0.3.2'
3
3
  end
data/sidecloq.gemspec CHANGED
@@ -20,13 +20,13 @@ Gem::Specification.new do |spec|
20
20
  spec.require_paths = ['lib']
21
21
 
22
22
  spec.add_dependency 'sidekiq', '>= 3.5.3', '< 5'
23
- spec.add_dependency 'redlock', '~> 0.1.2'
23
+ spec.add_dependency 'redlock', '~> 0.2.0'
24
24
  # mimics some dev dependencies of sidekiq:
25
25
  spec.add_dependency 'concurrent-ruby'
26
26
  spec.add_dependency 'rufus-scheduler', '~> 3.1', '>= 3.1.10'
27
27
 
28
- spec.add_development_dependency 'rake', '~> 10.0'
28
+ spec.add_development_dependency 'rake', '>= 10.0'
29
29
  spec.add_development_dependency 'minitest'
30
- spec.add_development_dependency 'redis-namespace', '~> 1.5', '>= 1.5.2'
30
+ spec.add_development_dependency 'redis-namespace', '~> 1.5', '>= 1.5.3'
31
31
  spec.add_development_dependency 'activejob'
32
32
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sidecloq
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
  - Matt Robinson
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-02-06 00:00:00.000000000 Z
11
+ date: 2017-03-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sidekiq
@@ -36,14 +36,14 @@ dependencies:
36
36
  requirements:
37
37
  - - "~>"
38
38
  - !ruby/object:Gem::Version
39
- version: 0.1.2
39
+ version: 0.2.0
40
40
  type: :runtime
41
41
  prerelease: false
42
42
  version_requirements: !ruby/object:Gem::Requirement
43
43
  requirements:
44
44
  - - "~>"
45
45
  - !ruby/object:Gem::Version
46
- version: 0.1.2
46
+ version: 0.2.0
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: concurrent-ruby
49
49
  requirement: !ruby/object:Gem::Requirement
@@ -82,14 +82,14 @@ dependencies:
82
82
  name: rake
83
83
  requirement: !ruby/object:Gem::Requirement
84
84
  requirements:
85
- - - "~>"
85
+ - - ">="
86
86
  - !ruby/object:Gem::Version
87
87
  version: '10.0'
88
88
  type: :development
89
89
  prerelease: false
90
90
  version_requirements: !ruby/object:Gem::Requirement
91
91
  requirements:
92
- - - "~>"
92
+ - - ">="
93
93
  - !ruby/object:Gem::Version
94
94
  version: '10.0'
95
95
  - !ruby/object:Gem::Dependency
@@ -115,7 +115,7 @@ dependencies:
115
115
  version: '1.5'
116
116
  - - ">="
117
117
  - !ruby/object:Gem::Version
118
- version: 1.5.2
118
+ version: 1.5.3
119
119
  type: :development
120
120
  prerelease: false
121
121
  version_requirements: !ruby/object:Gem::Requirement
@@ -125,7 +125,7 @@ dependencies:
125
125
  version: '1.5'
126
126
  - - ">="
127
127
  - !ruby/object:Gem::Version
128
- version: 1.5.2
128
+ version: 1.5.3
129
129
  - !ruby/object:Gem::Dependency
130
130
  name: activejob
131
131
  requirement: !ruby/object:Gem::Requirement