kthxbye 1.0.4 → 1.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.0.4
1
+ 1.0.5
data/lib/kthxbye/job.rb CHANGED
@@ -28,11 +28,11 @@ module Kthxbye
28
28
  redis.incr :uniq_id
29
29
  id = redis.get :uniq_id
30
30
 
31
- Job.add_to_queue( queue, id )
31
+ Job.add_to_queue( id, queue )
32
32
  Kthxbye.register_queue( queue )
33
33
 
34
34
  # mark job as inactive currently. will mark active when job is getting run
35
- redis.redis.sadd("jobs:inactive", id)
35
+ redis.sadd("jobs:inactive", id)
36
36
  redis.hset( "data-store:#{queue}", id, encode( {:klass => klass.to_s, :payload => args} ) )
37
37
  log "Created job in queue #{queue} with an unique key of #{id}"
38
38
 
data/test/test_failure.rb CHANGED
@@ -8,7 +8,7 @@ class TestFailure < Test::Unit::TestCase
8
8
 
9
9
  should "create a failure" do
10
10
  id = Kthxbye.enqueue("test", SimpleJob, 1, 2)
11
- assert Kthxbye::Failure.create(Kthxbye::Job.find(id, "test"), Exception.new("Test!"))
11
+ Kthxbye::Failure.create(Kthxbye::Job.find(id, "test"), Exception.new("Test!"))
12
12
 
13
13
  assert_not_nil f = Kthxbye::Failure.all.first
14
14
  assert_equal "Exception", f['type']
data/test/test_kthxbye.rb CHANGED
@@ -99,7 +99,7 @@ class TestKthxbye < Test::Unit::TestCase
99
99
  should "grab a job off the queue" do
100
100
  Kthxbye.enqueue("these-jobs", SimpleJob, {:hello => "world"}, "test params")
101
101
 
102
- assert job = Kthxbye.salvage("these-jobs")
102
+ assert_not_nil job = Kthxbye.salvage("these-jobs")
103
103
  assert_equal Kthxbye::Job, job.class
104
104
  assert_equal 1, job.id
105
105
  assert_equal "these-jobs", job.queue
@@ -133,15 +133,14 @@ class TestKthxbye < Test::Unit::TestCase
133
133
 
134
134
  should "delete a job" do
135
135
  id = Kthxbye.enqueue("test", SimpleJob, 1, 2 )
136
- assert_equal :active, Kthxbye::Job.destroy(id, "test")
136
+ assert_equal :inactive, Kthxbye::Job.destroy(id, "test")
137
137
  assert_equal nil, Kthxbye::Job.find(id, "test")
138
138
  end
139
139
 
140
140
  should "return all keys" do
141
141
  Kthxbye.enqueue("test", SimpleJob, 1, 2 )
142
- Kthxbye.register_queue("money")
143
142
 
144
- assert_equal ["data-store:test", "queue:test", "queues", "uniq_id"], Kthxbye.keys.sort
143
+ assert_equal ["data-store:test", "jobs:inactive", "queue:test", "queues", "uniq_id"], Kthxbye.keys.sort
145
144
  end
146
145
 
147
146
  should "register and unregister workers" do
@@ -181,11 +180,14 @@ class TestKthxbye < Test::Unit::TestCase
181
180
  bad_job = Kthxbye.enqueue( "bad", BadJob )
182
181
  job = Kthxbye::Job.find(good_job, "good")
183
182
 
184
- assert_equal :active, job.status
183
+ assert_equal :inactive, job.status
185
184
  job.dequeue
186
185
  assert_equal :inactive, job.status
187
186
  job.rerun
188
187
 
188
+ worker1.working(job)
189
+ assert_equal :active, job.status
190
+
189
191
  worker1.run
190
192
  assert_equal :succeeded, job.status
191
193
 
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kthxbye
3
3
  version: !ruby/object:Gem::Version
4
- hash: 31
4
+ hash: 29
5
5
  prerelease: false
6
6
  segments:
7
7
  - 1
8
8
  - 0
9
- - 4
10
- version: 1.0.4
9
+ - 5
10
+ version: 1.0.5
11
11
  platform: ruby
12
12
  authors:
13
13
  - Luke van der Hoeven