sidetiq 0.4.0 → 0.4.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +7 -0
- data/README.md +6 -4
- data/lib/sidetiq/clock.rb +1 -2
- data/lib/sidetiq/lock/meta_data.rb +3 -3
- data/lib/sidetiq/middleware/history.rb +1 -1
- data/lib/sidetiq/version.rb +1 -1
- data/lib/sidetiq/views/history.erb +1 -1
- data/sidetiq.gemspec +1 -2
- data/test/helper.rb +2 -2
- data/test/test_history.rb +2 -2
- data/test/test_lock_meta_data.rb +1 -1
- metadata +4 -18
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3baafa1fdc03a9ebae36e49a19cc51c4480ff400
|
4
|
+
data.tar.gz: 96e849289c2324d0942014256e3ff2de5748dd64
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 57d0a387e531eb91be1bb19266e4e2a9fd2e84e9da0658d5d7c955bb977ef548385b72db30201f3f07956796017f3e1d705ac91a14e0363c8b4899f5e860fb93
|
7
|
+
data.tar.gz: 5e56ab0f15722182c346c5e97a4c6d4211522a634e61bcd281aeaa146b35c2d3873ff8ef7ee13bd37c572608954cd8beb182a02e3dfef2f2f600e97b5ad94595
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -1,5 +1,5 @@
|
|
1
|
-
Sidetiq
|
2
|
-
|
1
|
+
![Sidetiq](http://f.cl.ly/items/1W3k0R2V2x3n3S1t1M0B/sidetiq.png)
|
2
|
+
=========
|
3
3
|
|
4
4
|
[![Build Status](https://travis-ci.org/tobiassvn/sidetiq.png)](https://travis-ci.org/tobiassvn/sidetiq)
|
5
5
|
[![Dependency Status](https://gemnasium.com/tobiassvn/sidetiq.png)](https://gemnasium.com/tobiassvn/sidetiq)
|
@@ -13,14 +13,16 @@ Overview
|
|
13
13
|
|
14
14
|
Sidetiq provides a simple API for defining recurring workers for Sidekiq.
|
15
15
|
|
16
|
-
-
|
16
|
+
- Concurrency and fault-tolerance using Celluloid actors.
|
17
17
|
|
18
|
-
- Flexible DSL based on [ice_cube](http://seejohnrun.github.com/ice_cube/)
|
18
|
+
- Flexible DSL based on [ice_cube](http://seejohnrun.github.com/ice_cube/).
|
19
19
|
|
20
20
|
- Distributed, Redis-based locking to synchronize multiple Sidetiq processes.
|
21
21
|
|
22
22
|
- Web extension with extensive monitoring of recurring jobs.
|
23
23
|
|
24
|
+
- Sidetiq runs in your Sidekiq processes. No extra resources required.
|
25
|
+
|
24
26
|
Usage
|
25
27
|
-----
|
26
28
|
|
data/lib/sidetiq/clock.rb
CHANGED
@@ -42,8 +42,7 @@ module Sidetiq
|
|
42
42
|
# # => Hash of Sidetiq::Schedule objects
|
43
43
|
#
|
44
44
|
# Returns a hash of Sidetiq::Schedule instances.
|
45
|
-
def tick
|
46
|
-
tick = gettime
|
45
|
+
def tick(tick = gettime)
|
47
46
|
Sidetiq.workers.each do |worker|
|
48
47
|
Sidetiq.handler.dispatch(worker, tick)
|
49
48
|
end
|
@@ -13,12 +13,12 @@ module Sidetiq
|
|
13
13
|
end
|
14
14
|
|
15
15
|
def from_json(json = "")
|
16
|
-
# Avoid TypeError when nil is passed to
|
16
|
+
# Avoid TypeError when nil is passed to Sidekiq.load_json.
|
17
17
|
json = "" if json.nil?
|
18
18
|
|
19
|
-
hash =
|
19
|
+
hash = Sidekiq.load_json(json).symbolize_keys
|
20
20
|
new(hash)
|
21
|
-
rescue
|
21
|
+
rescue StandardError => e
|
22
22
|
if json != ""
|
23
23
|
# Looks like garbage lock metadata, so report it.
|
24
24
|
handle_exception(e, context: "Garbage lock meta data detected: #{json}")
|
@@ -41,7 +41,7 @@ module Sidetiq
|
|
41
41
|
Sidekiq.redis do |redis|
|
42
42
|
list_name = "sidetiq:#{worker.class.name}:history"
|
43
43
|
|
44
|
-
redis.lpush(list_name,
|
44
|
+
redis.lpush(list_name, Sidekiq.dump_json(entry))
|
45
45
|
redis.ltrim(list_name, 0, Sidetiq.config.worker_history - 1)
|
46
46
|
end
|
47
47
|
end
|
data/lib/sidetiq/version.rb
CHANGED
@@ -19,7 +19,7 @@
|
|
19
19
|
</thead>
|
20
20
|
|
21
21
|
<% @history.each do |entry| %>
|
22
|
-
<% entry =
|
22
|
+
<% entry = Sidekiq.load_json(entry).symbolize_keys %>
|
23
23
|
<tr class="<%= 'error' if entry[:status] == 'failure' %>">
|
24
24
|
<td><%= entry[:status].capitalize %></td>
|
25
25
|
<td><%= Time.parse(entry[:timestamp]).strftime("%m/%d/%Y %I:%M:%S%p") %></td>
|
data/sidetiq.gemspec
CHANGED
@@ -19,10 +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.
|
22
|
+
gem.add_dependency 'sidekiq', '~> 2.15.0'
|
23
23
|
gem.add_dependency 'celluloid', '>= 0.14.1'
|
24
24
|
gem.add_dependency 'ice_cube', '~> 0.11.0'
|
25
|
-
gem.add_dependency 'json'
|
26
25
|
|
27
26
|
gem.add_development_dependency 'rake'
|
28
27
|
gem.add_development_dependency 'sinatra'
|
data/test/helper.rb
CHANGED
@@ -34,13 +34,13 @@ end
|
|
34
34
|
class Sidekiq::Client
|
35
35
|
# Sidekiq testing helper now overwrites raw_push so we need to use
|
36
36
|
# raw_push_old below to keep tests as is.
|
37
|
-
# https://github.com/mperham/sidekiq/blob/
|
37
|
+
# https://github.com/mperham/sidekiq/blob/master/lib/sidekiq/testing.rb
|
38
38
|
def self.push_old(item)
|
39
39
|
normed = normalize_item(item)
|
40
40
|
payload = process_single(item['class'], normed)
|
41
41
|
|
42
42
|
pushed = false
|
43
|
-
pushed =
|
43
|
+
pushed = self.__send__(:raw_push_real, [payload]) if payload
|
44
44
|
pushed ? payload['jid'] : nil
|
45
45
|
end
|
46
46
|
end
|
data/test/test_history.rb
CHANGED
@@ -13,7 +13,7 @@ class TestHistory < Sidetiq::TestCase
|
|
13
13
|
redis.lrange('sidetiq:TestHistory::HistoryWorker:history', 0, -1)
|
14
14
|
end
|
15
15
|
|
16
|
-
actual =
|
16
|
+
actual = Sidekiq.load_json(entry[0]).symbolize_keys
|
17
17
|
|
18
18
|
assert_equal 'success', actual[:status]
|
19
19
|
|
@@ -37,7 +37,7 @@ class TestHistory < Sidetiq::TestCase
|
|
37
37
|
redis.lrange('sidetiq:TestHistory::HistoryWorker:history', 0, -1)
|
38
38
|
end
|
39
39
|
|
40
|
-
actual =
|
40
|
+
actual = Sidekiq.load_json(entry[0]).symbolize_keys
|
41
41
|
|
42
42
|
assert_equal 'failure', actual[:status]
|
43
43
|
|
data/test/test_lock_meta_data.rb
CHANGED
@@ -78,7 +78,7 @@ class TestLockMetaData < Sidetiq::TestCase
|
|
78
78
|
hash = { timestamp: 42, owner: "me", key: "foobar" }
|
79
79
|
md = Sidetiq::Lock::MetaData.new(hash)
|
80
80
|
|
81
|
-
assert_equal hash,
|
81
|
+
assert_equal hash, Sidekiq.load_json(md.to_json).symbolize_keys
|
82
82
|
end
|
83
83
|
|
84
84
|
def test_to_s
|
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.4.
|
4
|
+
version: 0.4.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tobias Svensson
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-
|
11
|
+
date: 2013-10-01 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.
|
19
|
+
version: 2.15.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.
|
26
|
+
version: 2.15.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: celluloid
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -52,20 +52,6 @@ dependencies:
|
|
52
52
|
- - ~>
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: 0.11.0
|
55
|
-
- !ruby/object:Gem::Dependency
|
56
|
-
name: json
|
57
|
-
requirement: !ruby/object:Gem::Requirement
|
58
|
-
requirements:
|
59
|
-
- - '>='
|
60
|
-
- !ruby/object:Gem::Version
|
61
|
-
version: '0'
|
62
|
-
type: :runtime
|
63
|
-
prerelease: false
|
64
|
-
version_requirements: !ruby/object:Gem::Requirement
|
65
|
-
requirements:
|
66
|
-
- - '>='
|
67
|
-
- !ruby/object:Gem::Version
|
68
|
-
version: '0'
|
69
55
|
- !ruby/object:Gem::Dependency
|
70
56
|
name: rake
|
71
57
|
requirement: !ruby/object:Gem::Requirement
|