qu 0.1.3 → 0.1.4

Sign up to get free protection for your applications and to get access to all the features.
data/ChangeLog CHANGED
@@ -1,3 +1,15 @@
1
+ 0.1.4 - 2012-01-07
2
+
3
+ Enhancements:
4
+
5
+ * Add `poll_frequency` config for mongo backend
6
+ * Add qu-airbrake failure backend
7
+ * Add immediate backend for performing jobs immediately
8
+
9
+ require 'qu-immediate'
10
+
11
+ https://github.com/bkeepers/qu/compare/v0.1.3...v0.1.4
12
+
1
13
  0.1.3 - 2011-10-10
2
14
 
3
15
  Bug Fixes:
@@ -14,12 +26,15 @@
14
26
  c.backend.retry_frequency = 5 # default: 1
15
27
  end
16
28
 
29
+ https://github.com/bkeepers/qu/compare/v0.1.2..v0.1.3
30
+
17
31
  0.1.2 - 2011-10-05
18
32
 
19
33
  Bug Fixes:
20
34
 
21
35
  * Build gem with Ruby 1.8 to avoid YAML errors (http://blog.rubygems.org/2011/08/31/shaving-the-yaml-yacc.html)
22
36
 
37
+ https://github.com/bkeepers/qu/compare/v0.1.1...v0.1.2
23
38
 
24
39
  0.1.1 - 2011-10-02
25
40
 
data/README.md CHANGED
@@ -121,6 +121,14 @@ Qu.configure do |c|
121
121
  end
122
122
  ```
123
123
 
124
+ ## Tests
125
+
126
+ If you prefer to have jobs processed immediatly in your tests, there is an `Immediate` backend that will perform the job instead of enqueuing it. In your test helper, require qu-immediate:
127
+
128
+ ``` ruby
129
+ require 'qu-immediate'
130
+ ```
131
+
124
132
  ## Why another queuing library?
125
133
 
126
134
  Resque and delayed_job are both great, but both of them have shortcomings that can be frustrating in production applications.
@@ -0,0 +1,4 @@
1
+ require 'qu'
2
+ require 'qu/backend/immediate'
3
+
4
+ Qu.backend = Qu::Backend::Immediate.new
@@ -0,0 +1,18 @@
1
+ module Qu
2
+ module Backend
3
+ class Immediate < Base
4
+ def enqueue(payload)
5
+ payload.perform
6
+ end
7
+
8
+ def completed(payload)
9
+ end
10
+
11
+ def release(payload)
12
+ end
13
+
14
+ def failed(payload, error)
15
+ end
16
+ end
17
+ end
18
+ end
@@ -112,7 +112,7 @@ shared_examples_for 'a backend' do
112
112
  end
113
113
 
114
114
  it 'should not return an already reserved job' do
115
- subject.enqueue(payload)
115
+ subject.enqueue(payload.dup)
116
116
  subject.reserve(worker).id.should_not == subject.reserve(worker).id
117
117
  end
118
118
 
@@ -146,6 +146,20 @@ shared_examples_for 'a backend' do
146
146
  end.should be_true
147
147
  end
148
148
 
149
+ it 'should properly persist args' do
150
+ subject.clear
151
+ payload.args = ['a', 'b']
152
+ subject.enqueue(payload)
153
+ subject.reserve(worker).args.should == ['a', 'b']
154
+ end
155
+
156
+ it 'should properly persist a hash argument' do
157
+ subject.clear
158
+ payload.args = [{:a => 1, :b => 2}]
159
+ subject.enqueue(payload)
160
+ subject.reserve(worker).args.should == [{'a' => 1, 'b' => 2}]
161
+ end
162
+
149
163
  def timeout(count = 0.1, &block)
150
164
  SystemTimer.timeout(count, &block)
151
165
  rescue Timeout::Error
@@ -1,3 +1,3 @@
1
1
  module Qu
2
- VERSION = "0.1.3"
2
+ VERSION = "0.1.4"
3
3
  end
@@ -0,0 +1,15 @@
1
+ require 'spec_helper'
2
+ require 'qu-immediate'
3
+
4
+ describe Qu::Backend::Immediate do
5
+ let(:payload) { Qu::Payload.new(:klass => SimpleJob) }
6
+
7
+ before(:all) do
8
+ Qu.backend = described_class.new
9
+ end
10
+
11
+ it 'performs immediately' do
12
+ payload.should_receive(:perform)
13
+ subject.enqueue(payload)
14
+ end
15
+ end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: qu
3
3
  version: !ruby/object:Gem::Version
4
- hash: 29
4
+ hash: 19
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 3
10
- version: 0.1.3
9
+ - 4
10
+ version: 0.1.4
11
11
  platform: ruby
12
12
  authors:
13
13
  - Brandon Keepers
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-10-10 00:00:00 -04:00
18
+ date: 2012-01-07 00:00:00 -05:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -48,8 +48,10 @@ files:
48
48
  - Guardfile
49
49
  - README.md
50
50
  - Rakefile
51
+ - lib/qu-immediate.rb
51
52
  - lib/qu.rb
52
53
  - lib/qu/backend/base.rb
54
+ - lib/qu/backend/immediate.rb
53
55
  - lib/qu/backend/spec.rb
54
56
  - lib/qu/failure.rb
55
57
  - lib/qu/logger.rb
@@ -59,6 +61,7 @@ files:
59
61
  - lib/qu/version.rb
60
62
  - lib/qu/worker.rb
61
63
  - qu.gemspec
64
+ - spec/qu/backend/immediate_spec.rb
62
65
  - spec/qu/payload_spec.rb
63
66
  - spec/qu/worker_spec.rb
64
67
  - spec/qu_spec.rb
@@ -98,6 +101,7 @@ signing_key:
98
101
  specification_version: 3
99
102
  summary: ""
100
103
  test_files:
104
+ - spec/qu/backend/immediate_spec.rb
101
105
  - spec/qu/payload_spec.rb
102
106
  - spec/qu/worker_spec.rb
103
107
  - spec/qu_spec.rb