rubykiq 1.0.1 → 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +2 -0
- data/.travis.yml +3 -1
- data/CHANGELOG.md +16 -0
- data/Gemfile +2 -0
- data/README.md +1 -0
- data/Rakefile +1 -1
- data/lib/rubykiq.rb +1 -1
- data/lib/rubykiq/client.rb +3 -0
- data/lib/rubykiq/version.rb +1 -1
- data/spec/spec_helper.rb +1 -0
- data/spec/support/codeclimate.rb +2 -0
- data/spec/support/pry.rb +4 -1
- data/spec/unit/client_spec.rb +8 -11
- data/spec/unit/connection_spec.rb +1 -1
- data/spec/unit/rubykiq_spec.rb +0 -3
- metadata +5 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f16a7dd593de391c8588314bf0aaaba87b387308
|
4
|
+
data.tar.gz: 5c91ee1222eebf07a49e30dc695064f515cc31e6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4b784fe4ec2dc3d0c972793170b0cd58b740dc1a9c251c344f32ad709062d42399d38b83154ebd185e90b97141014c503e7367e909e655b9d970660ec91a0a0c
|
7
|
+
data.tar.gz: 2de3671bf79f3f07d5b2c554766eaae6d20520a8c4de3047c81208c06e91c9221e1a83407bdeb9afd4a175d4cbc9dfdf980793f871c0380f0350c21f3937073e
|
data/.gitignore
CHANGED
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -0,0 +1,16 @@
|
|
1
|
+
Next Release
|
2
|
+
============
|
3
|
+
* Your contribution here.
|
4
|
+
|
5
|
+
1.0.2 (02/08/2015)
|
6
|
+
==================
|
7
|
+
* [Include `enqueued_at` in payload](https://github.com/karlfreeman/rubykiq/commit/0a68c9dc670f94efe8a344869db0b7ba4a97d1d7) - [@amiel](https://github.com/karlfreeman).
|
8
|
+
|
9
|
+
|
10
|
+
1.0.1 (18/03/2014)
|
11
|
+
==================
|
12
|
+
* [Ensure loading a client is Thread.exclusive](https://github.com/karlfreeman/rubykiq/commit/0a68c9dc670f94efe8a344869db0b7ba4a97d1d7) - [@karlfreeman](https://github.com/karlfreeman).
|
13
|
+
|
14
|
+
1.0.0 (03/03/2014)
|
15
|
+
==================
|
16
|
+
* Initial public release - [@karlfreeman](https://github.com/karlfreeman).
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -69,6 +69,7 @@ bar_client = Rubykiq::Client.new(namespace: 'bar')
|
|
69
69
|
[![Gem Version](http://img.shields.io/gem/v/rubykiq.svg)][gem]
|
70
70
|
[![Build Status](http://img.shields.io/travis/karlfreeman/rubykiq.svg)][travis]
|
71
71
|
[![Code Quality](http://img.shields.io/codeclimate/github/karlfreeman/rubykiq.svg)][codeclimate]
|
72
|
+
[![Code Coverage](http://img.shields.io/codeclimate/coverage/github/karlfreeman/rubykiq.svg)][codeclimate]
|
72
73
|
[![Gittip](http://img.shields.io/gittip/karlfreeman.svg)][gittip]
|
73
74
|
|
74
75
|
## Supported Redis Drivers
|
data/Rakefile
CHANGED
data/lib/rubykiq.rb
CHANGED
@@ -12,7 +12,7 @@ module Rubykiq
|
|
12
12
|
def_delegators :client, *Rubykiq::Client::VALID_OPTIONS_KEYS
|
13
13
|
|
14
14
|
# delegate all VALID_OPTIONS_KEYS setters to the client ( hacky I know... )
|
15
|
-
def_delegators :client, *(Rubykiq::Client::VALID_OPTIONS_KEYS.dup.map!
|
15
|
+
def_delegators :client, *(Rubykiq::Client::VALID_OPTIONS_KEYS.dup.map! { |key| "#{key}=".to_sym; })
|
16
16
|
|
17
17
|
# Fetch the Rubykiq::Client
|
18
18
|
#
|
data/lib/rubykiq/client.rb
CHANGED
@@ -176,6 +176,9 @@ module Rubykiq
|
|
176
176
|
# provide a job ID
|
177
177
|
pre_normalized_item[:jid] = ::SecureRandom.hex(12)
|
178
178
|
|
179
|
+
# Sidekiq::Queue#latency (used in sidekiq web), requires `enqueued_at`
|
180
|
+
pre_normalized_item[:enqueued_at] = Time.now.to_f
|
181
|
+
|
179
182
|
pre_normalized_item
|
180
183
|
end
|
181
184
|
|
data/lib/rubykiq/version.rb
CHANGED
data/spec/spec_helper.rb
CHANGED
data/spec/support/pry.rb
CHANGED
data/spec/unit/client_spec.rb
CHANGED
@@ -20,7 +20,7 @@ describe Rubykiq::Client do
|
|
20
20
|
subject { client }
|
21
21
|
its(:namespace) { should eq driver }
|
22
22
|
its(:driver) { should be driver }
|
23
|
-
its(:retry) { should
|
23
|
+
its(:retry) { should eq true }
|
24
24
|
its(:queue) { should eq 'default' }
|
25
25
|
end
|
26
26
|
|
@@ -59,18 +59,17 @@ describe Rubykiq::Client do
|
|
59
59
|
context "with args #{args}" do
|
60
60
|
it "should create #{args.length} job(s)" do
|
61
61
|
wrap_in_synchrony?(driver) do
|
62
|
-
client.connection_pool
|
63
|
-
connection.flushdb
|
64
|
-
end
|
62
|
+
client.connection_pool(&:flushdb)
|
65
63
|
|
66
64
|
expect { client.push(class: 'MyWorker', args: args) }.to change {
|
67
|
-
client.connection_pool
|
65
|
+
client.connection_pool { |connection| connection.llen('queue:default'); }
|
68
66
|
}.from(0).to(args.length)
|
69
67
|
|
70
|
-
raw_jobs = client.connection_pool
|
68
|
+
raw_jobs = client.connection_pool { |connection| connection.lrange('queue:default', 0, args.length); }
|
71
69
|
raw_jobs.each do |job|
|
72
70
|
job = MultiJson.decode(job, symbolize_keys: true)
|
73
71
|
expect(job).to have_key(:jid)
|
72
|
+
expect(job[:enqueued_at]).to be_within(1).of(Time.now.to_f)
|
74
73
|
end
|
75
74
|
end
|
76
75
|
end
|
@@ -81,15 +80,13 @@ describe Rubykiq::Client do
|
|
81
80
|
context "with time #{time} (#{time.class})" do
|
82
81
|
it "should create #{args.length} job(s)" do
|
83
82
|
wrap_in_synchrony?(driver) do
|
84
|
-
client.connection_pool
|
85
|
-
connection.flushdb
|
86
|
-
end
|
83
|
+
client.connection_pool(&:flushdb)
|
87
84
|
|
88
85
|
expect { client.push(class: 'MyWorker', args: args, at: time) }.to change {
|
89
|
-
client.connection_pool
|
86
|
+
client.connection_pool { |connection| connection.zcard('schedule'); }
|
90
87
|
}.from(0).to(args.length)
|
91
88
|
|
92
|
-
raw_jobs = client.connection_pool
|
89
|
+
raw_jobs = client.connection_pool { |connection| connection.zrange('schedule', 0, args.length); }
|
93
90
|
raw_jobs.each do |job|
|
94
91
|
job = MultiJson.decode(job, symbolize_keys: true)
|
95
92
|
expect(job).to have_key(:at)
|
@@ -28,7 +28,7 @@ describe Rubykiq::Connection do
|
|
28
28
|
|
29
29
|
describe :env do
|
30
30
|
subject { Rubykiq::Connection.new }
|
31
|
-
[{ name: 'REDISTOGO_URL', value: 'redistogo' }, { name: 'REDIS_PROVIDER', value: 'redisprovider' }, { name: 'REDIS_URL', value: 'redisurl' }].each do |
|
31
|
+
[{ name: 'REDISTOGO_URL', value: 'redistogo' }, { name: 'REDIS_PROVIDER', value: 'redisprovider' }, { name: 'REDIS_URL', value: 'redisurl' }].each do |test_case|
|
32
32
|
context "with ENV[#{test_case[:name]}]" do
|
33
33
|
before do
|
34
34
|
ENV[test_case[:name]] = "redis://#{test_case[:value]}:6379/0"
|
data/spec/unit/rubykiq_spec.rb
CHANGED
@@ -1,8 +1,6 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe Rubykiq do
|
4
|
-
|
5
|
-
|
6
4
|
describe :client do
|
7
5
|
it 'should return a Client' do
|
8
6
|
expect(Rubykiq.client).to be_kind_of(Rubykiq::Client)
|
@@ -34,5 +32,4 @@ describe Rubykiq do
|
|
34
32
|
it { should respond_to "#{key}=".to_sym }
|
35
33
|
end
|
36
34
|
end
|
37
|
-
|
38
35
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rubykiq
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Karl Freeman
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-08-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: redis
|
@@ -174,6 +174,7 @@ files:
|
|
174
174
|
- lib/rubykiq/version.rb
|
175
175
|
- rubykiq.gemspec
|
176
176
|
- spec/spec_helper.rb
|
177
|
+
- spec/support/codeclimate.rb
|
177
178
|
- spec/support/pry.rb
|
178
179
|
- spec/support/timecop.rb
|
179
180
|
- spec/unit/client_spec.rb
|
@@ -199,12 +200,13 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
199
200
|
version: '0'
|
200
201
|
requirements: []
|
201
202
|
rubyforge_project:
|
202
|
-
rubygems_version: 2.
|
203
|
+
rubygems_version: 2.4.5
|
203
204
|
signing_key:
|
204
205
|
specification_version: 4
|
205
206
|
summary: Sidekiq agnostic enqueuing using Redis
|
206
207
|
test_files:
|
207
208
|
- spec/spec_helper.rb
|
209
|
+
- spec/support/codeclimate.rb
|
208
210
|
- spec/support/pry.rb
|
209
211
|
- spec/support/timecop.rb
|
210
212
|
- spec/unit/client_spec.rb
|