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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5ca85781f7ef90ef2a9f22d291cbbc934e58e13c
4
- data.tar.gz: 6f661d24f2c6804b93df589e37bf6024a1077fda
3
+ metadata.gz: b04b7cc75ee4bfc199cd0d844008ddbe233488f5
4
+ data.tar.gz: be839f3d4817872e6d968c49838e738ef096d0b5
5
5
  SHA512:
6
- metadata.gz: f3bdf15f517040645ac3c3e28c5feef804dcf6aae0a577550345036dd87daf9e771925a498c0bb545b94ea1136e349ec81a1e6021228e135d2153e7c378857fd
7
- data.tar.gz: fc4e0d15560841bce7bec4b4ecfef8350c6ec24a2eee9bfa6e50ae8b3d3f93f7e57e28a25e560631a627bc6a2b6cac9bcbc9992826970295e36f7084d137c23f
6
+ metadata.gz: 6cbcf675522a069a327442266facd020fd24a62798ca3466827ba340d6a78a90f04b01cb029732248d9d33933677847cb3f19949dbdbc00760b1a82c629925d7
7
+ data.tar.gz: 5a3118fac8bbc228f6e3ba656344a746c12b622f7204c0de6948ffd67ace5f61992a7b86672e2ba0ccdd65e28422660222dda8101e5b95df95d12bd63fdb097a
data/.travis.yml CHANGED
@@ -6,7 +6,6 @@ branches:
6
6
  services:
7
7
  - redis-server
8
8
  rvm:
9
- - 1.9.3
10
9
  - 2.0.0
11
10
  - 2.1.1
12
11
  - jruby-19mode
data/CHANGELOG.md CHANGED
@@ -1,3 +1,10 @@
1
+ 0.6.2
2
+ -----
3
+
4
+ - Lock ice cube to 0.11.1 to fix memory leaks [camjackson]
5
+ - Don't use Redis keys command [Connorhd ]
6
+ - Use Sidekiq.redis_pool in Schedulable [nkondratyev]
7
+
1
8
  0.6.1
2
9
  -----
3
10
 
@@ -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
- schedulable_redis.del(key)
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
- schedulable_redis.keys("sidetiq:#{name}:*")
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
- schedulable_redis.get("sidetiq:#{name}:#{key}")
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
- schedulable_redis.set("sidetiq:#{name}:#{key}", value)
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
-
@@ -8,7 +8,7 @@ module Sidetiq
8
8
  MINOR = 6
9
9
 
10
10
  # Public: Sidetiq patch level.
11
- PATCH = 1
11
+ PATCH = 2
12
12
 
13
13
  # Public: Sidetiq version suffix.
14
14
  SUFFIX = nil
@@ -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
- </div>
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
- @locks = Sidetiq::Lock::Redis.all.map(&:meta_data)
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', '>= 2.16.0'
22
+ gem.add_dependency 'sidekiq', '>= 3.0.0'
23
23
  gem.add_dependency 'celluloid', '>= 0.14.1'
24
- gem.add_dependency 'ice_cube', '~> 0.12.0'
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
@@ -13,6 +13,12 @@ require 'rack/test'
13
13
  require 'sidetiq'
14
14
  require 'sidetiq/web'
15
15
 
16
+ module Sidekiq
17
+ def self.server?
18
+ true
19
+ end
20
+ end
21
+
16
22
  class Sidetiq::Supervisor
17
23
  def self.clock
18
24
  @clock ||= Sidetiq::Clock.new
@@ -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.1
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-06-06 00:00:00.000000000 Z
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: 2.16.0
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: 2.16.0
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.12.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.12.0
54
+ version: 0.11.1
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: rake
57
57
  requirement: !ruby/object:Gem::Requirement