queue_classic 2.0.1 → 2.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/queue_classic.rb +14 -6
- data/lib/queue_classic/queue.rb +1 -1
- data/readme.md +4 -4
- metadata +1 -17
data/lib/queue_classic.rb
CHANGED
@@ -1,9 +1,6 @@
|
|
1
|
-
require "scrolls"
|
2
1
|
require "pg"
|
3
2
|
require "uri"
|
4
3
|
|
5
|
-
$: << File.expand_path(__FILE__, "lib")
|
6
|
-
|
7
4
|
require "queue_classic/okjson"
|
8
5
|
require "queue_classic/conn"
|
9
6
|
require "queue_classic/queries"
|
@@ -66,7 +63,7 @@ module QC
|
|
66
63
|
|
67
64
|
def self.default_queue
|
68
65
|
@default_queue ||= begin
|
69
|
-
Queue.new(QUEUE
|
66
|
+
Queue.new(QUEUE)
|
70
67
|
end
|
71
68
|
end
|
72
69
|
|
@@ -75,7 +72,7 @@ module QC
|
|
75
72
|
t0 = Time.now
|
76
73
|
yield
|
77
74
|
rescue => e
|
78
|
-
log({:
|
75
|
+
log({:at => "error", :error => e.inspect}.merge(data))
|
79
76
|
raise
|
80
77
|
ensure
|
81
78
|
t = Integer((Time.now - t0)*1000)
|
@@ -84,7 +81,18 @@ module QC
|
|
84
81
|
end
|
85
82
|
|
86
83
|
def self.log(data)
|
87
|
-
|
84
|
+
result = nil
|
85
|
+
data = {:lib => "queue-classic"}.merge(data)
|
86
|
+
if block_given?
|
87
|
+
start = Time.now
|
88
|
+
result = yield
|
89
|
+
data.merge(:elapsed => Time.now - start)
|
90
|
+
end
|
91
|
+
data.reduce(out=String.new) do |s, tup|
|
92
|
+
s << [tup.first, tup.last].join("=") << " "
|
93
|
+
end
|
94
|
+
puts(out) if ENV["DEBUG"]
|
95
|
+
return result
|
88
96
|
end
|
89
97
|
|
90
98
|
end
|
data/lib/queue_classic/queue.rb
CHANGED
data/readme.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# queue_classic
|
2
2
|
|
3
|
-
v2.0.
|
3
|
+
v2.0.3
|
4
4
|
|
5
5
|
queue_classic provides PostgreSQL-backed queueing focused on concurrent job
|
6
6
|
locking and minimizing database load while providing a simple, intuitive user
|
@@ -69,7 +69,7 @@ $ ruby -r queue_classic -e "QC::Worker.new.work"
|
|
69
69
|
|
70
70
|
```ruby
|
71
71
|
source :rubygems
|
72
|
-
gem "queue_classic", "2.0.
|
72
|
+
gem "queue_classic", "2.0.1"
|
73
73
|
```
|
74
74
|
|
75
75
|
**Rakefile**
|
@@ -90,7 +90,7 @@ queue_classic requires a database table and a PL/pgSQL function to be loaded
|
|
90
90
|
into your database. You can load the table and the function by running a migration
|
91
91
|
or using a rake task.
|
92
92
|
|
93
|
-
**db/
|
93
|
+
**db/migrate/add_queue_classic.rb**
|
94
94
|
|
95
95
|
```ruby
|
96
96
|
require 'queue_classic'
|
@@ -128,7 +128,7 @@ require 'queue_classic'
|
|
128
128
|
|
129
129
|
Sequel.migration do
|
130
130
|
up {QC::Setup.create}
|
131
|
-
down {QC::Setup.
|
131
|
+
down {QC::Setup.drop}
|
132
132
|
end
|
133
133
|
```
|
134
134
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: queue_classic
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -27,22 +27,6 @@ dependencies:
|
|
27
27
|
- - ~>
|
28
28
|
- !ruby/object:Gem::Version
|
29
29
|
version: 0.14.0
|
30
|
-
- !ruby/object:Gem::Dependency
|
31
|
-
name: scrolls
|
32
|
-
requirement: !ruby/object:Gem::Requirement
|
33
|
-
none: false
|
34
|
-
requirements:
|
35
|
-
- - ~>
|
36
|
-
- !ruby/object:Gem::Version
|
37
|
-
version: 0.2.1
|
38
|
-
type: :runtime
|
39
|
-
prerelease: false
|
40
|
-
version_requirements: !ruby/object:Gem::Requirement
|
41
|
-
none: false
|
42
|
-
requirements:
|
43
|
-
- - ~>
|
44
|
-
- !ruby/object:Gem::Version
|
45
|
-
version: 0.2.1
|
46
30
|
description: queue_classic is a queueing library for Ruby apps. (Rails, Sinatra, Etc...)
|
47
31
|
queue_classic features asynchronous job polling, database maintained locks and no
|
48
32
|
ridiculous dependencies. As a matter of fact, queue_classic only requires pg.
|