queue_classic 3.0.0 → 3.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/queue_classic/conn_adapter.rb +0 -1
- data/lib/queue_classic/tasks.rb +1 -1
- data/lib/queue_classic/worker.rb +1 -1
- data/readme.md +2 -2
- data/test/worker_test.rb +45 -0
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9f51bc9067f68e130bfeeaa2ca5a34fdc1d7deff
|
4
|
+
data.tar.gz: 7c1af02c3ffa6dfb3933465a5bf96b616d859d3b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c01bf547c204d77353b918e82481a4a7a2c71eed42d634a97da972178d86f5224e631db1097ae54f30cc930786fdfb1b068717c19338226a608632c5a36f14ad
|
7
|
+
data.tar.gz: 6458a6dd13ee5dd58ccca5fd2f5a64e6b3cf74524143d6bef3b83ab4b83cdb59d98e27264ccc0fc5a0d009efa0983bab5eac8fee9381a5b3155dd192024562e1
|
data/lib/queue_classic/tasks.rb
CHANGED
@@ -29,7 +29,7 @@ namespace :qc do
|
|
29
29
|
|
30
30
|
desc "Returns the number of jobs in the (default or QUEUE) queue"
|
31
31
|
task :count => :environment do
|
32
|
-
puts QC
|
32
|
+
puts QC.default_queue.count
|
33
33
|
end
|
34
34
|
|
35
35
|
desc "Setup queue_classic tables and functions in database"
|
data/lib/queue_classic/worker.rb
CHANGED
data/readme.md
CHANGED
@@ -4,7 +4,7 @@
|
|
4
4
|
[![Code Climate](https://codeclimate.com/github/ryandotsmith/queue_classic.png)](https://codeclimate.com/github/ryandotsmith/queue_classic)
|
5
5
|
|
6
6
|
Stable: [v2.2.3](https://github.com/ryandotsmith/queue_classic/tree/v2.2.3)
|
7
|
-
Latest: v3.0.
|
7
|
+
Latest: v3.0.0
|
8
8
|
|
9
9
|
queue_classic provides a simple interface to a PostgreSQL-backed message queue. queue_classic specializes in concurrent locking and minimizing database load while providing a simple, intuitive developer experience. queue_classic assumes that you are already using PostgreSQL in your production environment and that adding another dependency (e.g. redis, beanstalkd, 0mq) is undesirable.
|
10
10
|
|
@@ -138,7 +138,7 @@ $ ruby -r queue_classic -e "QC::Worker.new.work"
|
|
138
138
|
Declare dependencies in Gemfile.
|
139
139
|
```ruby
|
140
140
|
source "http://rubygems.org"
|
141
|
-
gem "queue_classic", "3.0.
|
141
|
+
gem "queue_classic", "~> 3.0.0"
|
142
142
|
```
|
143
143
|
|
144
144
|
Add the database tables and stored procedures.
|
data/test/worker_test.rb
CHANGED
@@ -174,4 +174,49 @@ class WorkerTest < QCTest
|
|
174
174
|
assert_equal(42, r)
|
175
175
|
assert_equal(0, worker.failed_count)
|
176
176
|
end
|
177
|
+
|
178
|
+
def test_init_worker_with_arg
|
179
|
+
set_database 'postgres:///invalid'
|
180
|
+
|
181
|
+
conn = PG::Connection.connect(dbname: 'queue_classic_test')
|
182
|
+
worker = QC::Worker.new connection: conn
|
183
|
+
|
184
|
+
conn.close
|
185
|
+
reset_database
|
186
|
+
end
|
187
|
+
|
188
|
+
def test_init_worker_with_database_url
|
189
|
+
set_database ENV['DATABASE_URL'] || ENV['QC_DATABASE_URL']
|
190
|
+
|
191
|
+
worker = QC::Worker.new
|
192
|
+
QC.enqueue("TestObject.no_args")
|
193
|
+
worker.lock_job
|
194
|
+
|
195
|
+
QC.default_conn_adapter.disconnect
|
196
|
+
reset_database
|
197
|
+
end
|
198
|
+
|
199
|
+
def test_init_worker_without_conn
|
200
|
+
set_database nil
|
201
|
+
|
202
|
+
assert_raises(ArgumentError) { QC::Worker.new }
|
203
|
+
|
204
|
+
reset_database
|
205
|
+
end
|
206
|
+
|
207
|
+
private
|
208
|
+
|
209
|
+
def set_database(url)
|
210
|
+
@database_url = ENV['DATABASE_URL']
|
211
|
+
@qc_database_url = ENV['QC_DATABASE_URL']
|
212
|
+
ENV['DATABASE_URL'] = ENV['QC_DATABASE_URL'] = url
|
213
|
+
@conn_adapter = QC.default_conn_adapter
|
214
|
+
QC.default_conn_adapter = nil
|
215
|
+
end
|
216
|
+
|
217
|
+
def reset_database
|
218
|
+
ENV['DATABASE_URL'] = @database_url
|
219
|
+
ENV['QC_DATABASE_URL'] = @qc_database_url
|
220
|
+
QC.default_conn_adapter = @conn_adapter
|
221
|
+
end
|
177
222
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: queue_classic
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.0.
|
4
|
+
version: 3.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ryan Smith (♠ ace hacker)
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2014-09-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: pg
|
@@ -53,7 +53,7 @@ files:
|
|
53
53
|
- test/lib/queue_classic_test.rb
|
54
54
|
- test/queue_test.rb
|
55
55
|
- test/worker_test.rb
|
56
|
-
homepage: http://github.com/
|
56
|
+
homepage: http://github.com/QueueClassic/queue_classic
|
57
57
|
licenses:
|
58
58
|
- MIT
|
59
59
|
metadata: {}
|