sidetiq 0.6.1 → 0.6.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +0 -1
- data/CHANGELOG.md +7 -0
- data/lib/sidetiq/schedulable.rb +4 -9
- data/lib/sidetiq/version.rb +1 -1
- data/lib/sidetiq/views/locks.erb +4 -1
- data/lib/sidetiq/web.rb +6 -1
- data/sidetiq.gemspec +2 -2
- data/test/helper.rb +6 -0
- data/test/test_schedulable.rb +15 -0
- metadata +8 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b04b7cc75ee4bfc199cd0d844008ddbe233488f5
|
4
|
+
data.tar.gz: be839f3d4817872e6d968c49838e738ef096d0b5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6cbcf675522a069a327442266facd020fd24a62798ca3466827ba340d6a78a90f04b01cb029732248d9d33933677847cb3f19949dbdbc00760b1a82c629925d7
|
7
|
+
data.tar.gz: 5a3118fac8bbc228f6e3ba656344a746c12b622f7204c0de6948ffd67ace5f61992a7b86672e2ba0ccdd65e28422660222dda8101e5b95df95d12bd63fdb097a
|
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
data/lib/sidetiq/schedulable.rb
CHANGED
@@ -45,7 +45,7 @@ module Sidetiq
|
|
45
45
|
old_description = get_schedulable_key("schedule_description")
|
46
46
|
if old_description != schedule.to_s
|
47
47
|
get_schedulable_keys.map do |key|
|
48
|
-
|
48
|
+
Sidekiq.redis_pool.with { |r| r.del(key) }
|
49
49
|
end
|
50
50
|
set_schedulable_key("schedule_description", schedule.to_s)
|
51
51
|
end
|
@@ -53,20 +53,16 @@ module Sidetiq
|
|
53
53
|
|
54
54
|
private
|
55
55
|
|
56
|
-
def schedulable_redis
|
57
|
-
Sidekiq.redis { |redis| redis }
|
58
|
-
end
|
59
|
-
|
60
56
|
def get_schedulable_keys
|
61
|
-
|
57
|
+
%w(next last schedule_description history).map { |key| "sidetiq:#{name}:#{key}" }
|
62
58
|
end
|
63
59
|
|
64
60
|
def get_schedulable_key(key)
|
65
|
-
|
61
|
+
Sidekiq.redis_pool.with { |r| r.get("sidetiq:#{name}:#{key}") }
|
66
62
|
end
|
67
63
|
|
68
64
|
def set_schedulable_key(key, value)
|
69
|
-
|
65
|
+
Sidekiq.redis_pool.with { |r| r.set("sidetiq:#{name}:#{key}", value) }
|
70
66
|
end
|
71
67
|
|
72
68
|
def get_timestamp(key)
|
@@ -83,4 +79,3 @@ module Sidetiq
|
|
83
79
|
end
|
84
80
|
end
|
85
81
|
end
|
86
|
-
|
data/lib/sidetiq/version.rb
CHANGED
data/lib/sidetiq/views/locks.erb
CHANGED
@@ -13,6 +13,7 @@
|
|
13
13
|
<%= erb File.read(File.join(view_path, '_home_nav.erb')) %>
|
14
14
|
|
15
15
|
<div class="col-md-9">
|
16
|
+
<% if @locks_available %>
|
16
17
|
<% if @locks.length > 0 %>
|
17
18
|
<table class="table table-striped table-bordered table-white table-sidetiq">
|
18
19
|
<thead>
|
@@ -44,7 +45,9 @@
|
|
44
45
|
<% else %>
|
45
46
|
<div class="alert alert-success">No locks set.</div>
|
46
47
|
<% end %>
|
47
|
-
|
48
|
+
<% else %>
|
49
|
+
<div class="alert alert-danger">KEYS command is disabled in your redis instance, lock information is not available.</div>
|
50
|
+
<% end %>
|
48
51
|
</div>
|
49
52
|
</div>
|
50
53
|
|
data/lib/sidetiq/web.rb
CHANGED
@@ -13,7 +13,12 @@ module Sidetiq
|
|
13
13
|
end
|
14
14
|
|
15
15
|
app.get "/sidetiq/locks" do
|
16
|
-
|
16
|
+
begin
|
17
|
+
@locks = Sidetiq::Lock::Redis.all.map(&:meta_data)
|
18
|
+
@locks_available = true
|
19
|
+
rescue Redis::CommandError
|
20
|
+
@locks_available = false
|
21
|
+
end
|
17
22
|
|
18
23
|
erb File.read(File.join(VIEWS, 'locks.erb')), locals: {view_path: VIEWS}
|
19
24
|
end
|
data/sidetiq.gemspec
CHANGED
@@ -19,9 +19,9 @@ Gem::Specification.new do |gem|
|
|
19
19
|
gem.require_paths = ["lib"]
|
20
20
|
gem.extensions = []
|
21
21
|
|
22
|
-
gem.add_dependency 'sidekiq', '>=
|
22
|
+
gem.add_dependency 'sidekiq', '>= 3.0.0'
|
23
23
|
gem.add_dependency 'celluloid', '>= 0.14.1'
|
24
|
-
gem.add_dependency 'ice_cube', '
|
24
|
+
gem.add_dependency 'ice_cube', '0.11.1'
|
25
25
|
|
26
26
|
gem.add_development_dependency 'rake'
|
27
27
|
gem.add_development_dependency 'sinatra'
|
data/test/helper.rb
CHANGED
data/test/test_schedulable.rb
CHANGED
@@ -1,10 +1,25 @@
|
|
1
1
|
require_relative 'helper'
|
2
|
+
require 'minitest/mock'
|
2
3
|
|
3
4
|
class TestShedulable < Sidetiq::TestCase
|
4
5
|
class FakeWorker
|
5
6
|
include Sidetiq::Schedulable
|
6
7
|
end
|
7
8
|
|
9
|
+
def test_recurrence
|
10
|
+
Sidekiq.stub(:server?, true) do
|
11
|
+
Sidekiq.expects(:redis_pool).returns(Sidekiq::RedisConnection.create).at_least(1)
|
12
|
+
|
13
|
+
FakeWorker.recurrence { hourly }
|
14
|
+
end
|
15
|
+
|
16
|
+
Sidekiq.stub(:server?, false) do
|
17
|
+
Sidekiq.expects(:redis_pool).times(0)
|
18
|
+
|
19
|
+
FakeWorker.recurrence { hourly }
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
8
23
|
def test_resheduling
|
9
24
|
last_run = (Time.now - 100).to_f
|
10
25
|
next_run = (Time.now + 100).to_f
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sidetiq
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
4
|
+
version: 0.6.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tobias Svensson
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-09-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: sidekiq
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
19
|
+
version: 3.0.0
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version:
|
26
|
+
version: 3.0.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: celluloid
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -42,16 +42,16 @@ dependencies:
|
|
42
42
|
name: ice_cube
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- -
|
45
|
+
- - '='
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: 0.
|
47
|
+
version: 0.11.1
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- -
|
52
|
+
- - '='
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: 0.
|
54
|
+
version: 0.11.1
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: rake
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|