sqeduler 0.3.6 → 0.3.7

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: 999b1300f9f730cc4648c14082aa596a2e16195a
4
- data.tar.gz: 4922c321fa003eb1657664182fd7320c9d2092a2
3
+ metadata.gz: dd29046cb516b9fafdbd2ec01a41adb53478cf82
4
+ data.tar.gz: 739c3c00428e9805ef77f87596a16bd4efe6fdf8
5
5
  SHA512:
6
- metadata.gz: 1123efb89e5e45441d4c63690d2c1536ff250e9e5722fafce6c9f27cf2741013d0556707608c5f3c6f0cdaab57fc79a2e58e04138b647f722fadbf03603c3c18
7
- data.tar.gz: d0205b540bbed7c43215fba5b956d8beef3c86d8eecf995da154dd44de1f89b372ac090528fac46b951cffd1fa353e0b7c2d281a43afb1b1ac795b6f12f481e6
6
+ metadata.gz: da595ba77cd4088ea1b437ff37cd5ab4dc033e28b476e88f3555fa5a421ff8217fbab5b518be48fb71e610c32d1fb67120d6172da838ed099852289b3c4249d2
7
+ data.tar.gz: 1bcdb26ae008247dc0dca1d079a723c3a031bf7c7e0ffc26d59f56f323b2ec85af51cdda2ae16a9347781cafeee54ab1cc742c872cd9c9ebf1545c447aa0f0b5
data/.rubocop.yml CHANGED
@@ -16,7 +16,7 @@ Metrics/LineLength:
16
16
  Max: 120
17
17
 
18
18
  Metrics/MethodLength:
19
- Max: 20
19
+ Max: 25
20
20
 
21
21
  Style/HashSyntax:
22
22
  EnforcedStyle: hash_rockets
data/.travis.yml CHANGED
@@ -1,7 +1,11 @@
1
1
  language: ruby
2
2
  rvm:
3
- - 2.1
4
- - 2.2
3
+ - 2.2.5
4
+ - 2.3.1
5
5
  services:
6
6
  - redis-server
7
- before_install: gem update bundler
7
+ before_install:
8
+ - gem update --system
9
+ - gem --version
10
+ - gem update bundler
11
+ - bundle --version
data/CHANGES.md CHANGED
@@ -1,3 +1,7 @@
1
+ ### 0.3.7 / 2016-09-21
2
+
3
+ * Fixed a bug introduced by sidekiq-scheduler 2.0.9 that resulted in the schedule being empty
4
+
1
5
  ### 0.3.6 / 2016-06-16
2
6
 
3
7
  * Symbolize keys in redis config hash
@@ -14,7 +14,6 @@ module Sqeduler
14
14
  raise "No config provided" unless config
15
15
  config_sidekiq_server
16
16
  config_sidekiq_client
17
- config_scheduler
18
17
  end
19
18
 
20
19
  def verify_redis_pool(redis_pool)
@@ -33,10 +32,22 @@ module Sqeduler
33
32
  ::Sidekiq.configure_server do |config|
34
33
  setup_sidekiq_redis(config)
35
34
  if Service.scheduling?
35
+ logger.info "Initializing Sidekiq::Scheduler with schedule #{::Sqeduler::Service.config.schedule_path}"
36
+
37
+ config.on(:startup) do
38
+ ::Sidekiq::Scheduler.rufus_scheduler_options = {
39
+ :trigger_lock => TriggerLock.new
40
+ }
41
+ ::Sidekiq.schedule = ::Sqeduler::Service.parse_schedule(::Sqeduler::Service.config.schedule_path)
42
+ ::Sidekiq::Scheduler.reload_schedule!
43
+ end
44
+
36
45
  config.on(:shutdown) do
37
46
  # Make sure any scheduling locks are released on shutdown.
38
- Sidekiq::Scheduler.rufus_scheduler.stop
47
+ ::Sidekiq::Scheduler.rufus_scheduler.stop
39
48
  end
49
+ else
50
+ logger.warn "No schedule_path provided. Not starting Sidekiq::Scheduler."
40
51
  end
41
52
 
42
53
  # the server can also enqueue jobs
@@ -68,18 +79,6 @@ module Sqeduler
68
79
  config.redis = Service.config.redis_hash
69
80
  end
70
81
 
71
- def config_scheduler
72
- if scheduling?
73
- logger.info "Initializing Sidekiq::Scheduler with schedule #{config.schedule_path}"
74
- ::Sidekiq::Scheduler.rufus_scheduler_options = {
75
- :trigger_lock => TriggerLock.new
76
- }
77
- ::Sidekiq.schedule = parse_schedule(config.schedule_path)
78
- else
79
- logger.warn "No schedule_path provided. Not starting Sidekiq::Scheduler."
80
- end
81
- end
82
-
83
82
  def parse_schedule(path)
84
83
  raise "Schedule file #{path} does not exist!" unless File.exist?(path)
85
84
  file_contents = File.read(path)
@@ -1,4 +1,4 @@
1
1
  # encoding: utf-8
2
2
  module Sqeduler
3
- VERSION = "0.3.6".freeze
3
+ VERSION = "0.3.7".freeze
4
4
  end
@@ -27,6 +27,6 @@ RSpec.describe "Sidekiq integration" do
27
27
  end
28
28
  Process.kill("INT", pid)
29
29
  Process.wait(pid, 0)
30
- expect(File).to exist(FakeWorker::JOB_RUN_PATH)
30
+ expect(File.exist?(FakeWorker::JOB_RUN_PATH)).to be_truthy
31
31
  end
32
32
  end
data/spec/service_spec.rb CHANGED
@@ -17,7 +17,7 @@ RSpec.describe Sqeduler::Service do
17
17
 
18
18
  context "no config provided" do
19
19
  it "should raise" do
20
- expect { subject }.to raise_error
20
+ expect { subject }.to raise_error(RuntimeError, "No config provided")
21
21
  end
22
22
  end
23
23
 
@@ -38,12 +38,12 @@ RSpec.describe Sqeduler::Service do
38
38
  )
39
39
  end
40
40
 
41
- it "starts the server" do
41
+ it "configures the server" do
42
42
  expect(Sidekiq).to receive(:configure_server)
43
43
  subject
44
44
  end
45
45
 
46
- it "starts the client" do
46
+ it "configures the client" do
47
47
  expect(Sidekiq).to receive(:configure_client)
48
48
  subject
49
49
  end
@@ -58,47 +58,6 @@ RSpec.describe Sqeduler::Service do
58
58
  expect(client_receiver).to receive(:call)
59
59
  subject
60
60
  end
61
-
62
- context "a schedule_path is provided" do
63
- it "starts the scheduler" do
64
- expect(Sidekiq).to receive(:"schedule=").with(
65
- "FakeWorker" => {
66
- "every" => "5s"
67
- }
68
- )
69
- subject
70
- expect(Sidekiq::Scheduler.rufus_scheduler_options).to have_key(:trigger_lock)
71
- expect(Sidekiq::Scheduler.rufus_scheduler_options[:trigger_lock]).to be_kind_of(
72
- Sqeduler::TriggerLock
73
- )
74
- end
75
-
76
- context "a schedule_path is a string" do
77
- let(:schedule_filepath) { "./spec/fixtures/schedule.yaml" }
78
-
79
- it "starts the scheduler" do
80
- expect(Sidekiq).to receive(:"schedule=").with(
81
- "FakeWorker" => {
82
- "every" => "5s"
83
- }
84
- )
85
- subject
86
- expect(Sidekiq::Scheduler.rufus_scheduler_options).to have_key(:trigger_lock)
87
- expect(Sidekiq::Scheduler.rufus_scheduler_options[:trigger_lock]).to be_kind_of(
88
- Sqeduler::TriggerLock
89
- )
90
- end
91
- end
92
- end
93
-
94
- context "a schedule_path is not provided" do
95
- let(:schedule_filepath) { nil }
96
-
97
- it "does not start the scheduler" do
98
- expect(Sidekiq).to_not receive(:"schedule=")
99
- subject
100
- end
101
- end
102
61
  end
103
62
  end
104
63
 
@@ -134,7 +93,7 @@ RSpec.describe Sqeduler::Service do
134
93
  allow_any_instance_of(Redis).to receive(:info).and_return(
135
94
  "redis_version" => "2.6.11"
136
95
  )
137
- expect { subject }.to raise_error
96
+ expect { subject }.to raise_error(RuntimeError, "Must be using redis >= 2.6.12")
138
97
  end
139
98
  end
140
99
 
@@ -168,7 +127,7 @@ RSpec.describe Sqeduler::Service do
168
127
  end
169
128
 
170
129
  it "should raise" do
171
- expect { described_class.redis_pool }.to raise_error
130
+ expect { described_class.redis_pool }.to raise_error(RuntimeError, "Must be using redis >= 2.6.12")
172
131
  end
173
132
  end
174
133
 
@@ -226,7 +185,7 @@ RSpec.describe Sqeduler::Service do
226
185
  let(:logger) { nil }
227
186
 
228
187
  it "should raise ArgumentError" do
229
- expect { subject }.to raise_error(ArgumentError)
188
+ expect { subject }.to raise_error(ArgumentError, /^No logger provided/)
230
189
  end
231
190
 
232
191
  context "in a Rails app" do
data/spec/spec_helper.rb CHANGED
@@ -12,7 +12,7 @@ RSpec.configure do |config|
12
12
  config.before(:each) do
13
13
  TEST_REDIS.flushdb
14
14
  Sqeduler::Service.config = nil
15
- REDIS_CONFIG = { :host => "localhost", :db => 1 }.clone
15
+ stub_const("REDIS_CONFIG", :host => "localhost", :db => 1)
16
16
  end
17
17
  config.disable_monkey_patching!
18
18
  end
data/spec/worker_spec.rb CHANGED
@@ -4,12 +4,12 @@ require "./spec/fixtures/fake_worker"
4
4
 
5
5
  RSpec.describe Sqeduler::Worker do
6
6
  def verify_callback_occured(file_path, times = 1)
7
- expect(File).to exist(file_path)
7
+ expect(File.exist?(file_path)).to be_truthy
8
8
  expect(File.read(file_path).length).to eq(times)
9
9
  end
10
10
 
11
11
  def verify_callback_skipped(file_path)
12
- expect(File).to_not exist(file_path)
12
+ expect(File.exist?(file_path)).to be_falsey
13
13
  end
14
14
 
15
15
  def maybe_cleanup_file(file_path)
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.6
4
+ version: 0.3.7
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-06-16 00:00:00.000000000 Z
11
+ date: 2016-09-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sidekiq
@@ -234,7 +234,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
234
234
  version: '0'
235
235
  requirements: []
236
236
  rubyforge_project:
237
- rubygems_version: 2.4.6
237
+ rubygems_version: 2.5.1
238
238
  signing_key:
239
239
  specification_version: 4
240
240
  summary: Common Sidekiq infrastructure for multi-host applications.
@@ -254,4 +254,3 @@ test_files:
254
254
  - spec/worker/kill_switch_spec.rb
255
255
  - spec/worker/synchronization_spec.rb
256
256
  - spec/worker_spec.rb
257
- has_rdoc: