qu-mongo 0.1.4 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/qu/backend/mongo.rb +3 -12
- metadata +10 -12
data/lib/qu/backend/mongo.rb
CHANGED
@@ -21,7 +21,8 @@ module Qu
|
|
21
21
|
|
22
22
|
def connection
|
23
23
|
@connection ||= begin
|
24
|
-
|
24
|
+
host_uri = (ENV['MONGOHQ_URL'] || ENV['MONGOLAB_URI']).to_s
|
25
|
+
uri = URI.parse(host_uri)
|
25
26
|
database = uri.path.empty? ? 'qu' : uri.path[1..-1]
|
26
27
|
options = {}
|
27
28
|
if uri.password
|
@@ -96,16 +97,6 @@ module Qu
|
|
96
97
|
def completed(payload)
|
97
98
|
end
|
98
99
|
|
99
|
-
def requeue(id)
|
100
|
-
logger.debug "Requeuing job #{id}"
|
101
|
-
doc = jobs('failed').find_and_modify(:query => {:_id => id}, :remove => true) || raise(::Mongo::OperationFailure)
|
102
|
-
jobs(doc.delete('queue')).insert(doc)
|
103
|
-
doc['id'] = doc.delete('_id')
|
104
|
-
Payload.new(doc)
|
105
|
-
rescue ::Mongo::OperationFailure
|
106
|
-
false
|
107
|
-
end
|
108
|
-
|
109
100
|
def register_worker(worker)
|
110
101
|
logger.debug "Registering worker #{worker.id}"
|
111
102
|
self[:workers].insert(worker.attributes.merge(:id => worker.id))
|
@@ -153,4 +144,4 @@ module Qu
|
|
153
144
|
|
154
145
|
end
|
155
146
|
end
|
156
|
-
end
|
147
|
+
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: qu-mongo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 23
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
-
|
10
|
-
version: 0.
|
8
|
+
- 2
|
9
|
+
- 0
|
10
|
+
version: 0.2.0
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Brandon Keepers
|
@@ -15,8 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2012-
|
19
|
-
default_executable:
|
18
|
+
date: 2012-06-13 00:00:00 Z
|
20
19
|
dependencies:
|
21
20
|
- !ruby/object:Gem::Dependency
|
22
21
|
name: mongo
|
@@ -40,12 +39,12 @@ dependencies:
|
|
40
39
|
requirements:
|
41
40
|
- - "="
|
42
41
|
- !ruby/object:Gem::Version
|
43
|
-
hash:
|
42
|
+
hash: 23
|
44
43
|
segments:
|
45
44
|
- 0
|
46
|
-
-
|
47
|
-
-
|
48
|
-
version: 0.
|
45
|
+
- 2
|
46
|
+
- 0
|
47
|
+
version: 0.2.0
|
49
48
|
type: :runtime
|
50
49
|
version_requirements: *id002
|
51
50
|
- !ruby/object:Gem::Dependency
|
@@ -74,7 +73,6 @@ extra_rdoc_files: []
|
|
74
73
|
files:
|
75
74
|
- lib/qu-mongo.rb
|
76
75
|
- lib/qu/backend/mongo.rb
|
77
|
-
has_rdoc: true
|
78
76
|
homepage: http://github.com/bkeepers/qu
|
79
77
|
licenses: []
|
80
78
|
|
@@ -104,7 +102,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
104
102
|
requirements: []
|
105
103
|
|
106
104
|
rubyforge_project:
|
107
|
-
rubygems_version: 1.
|
105
|
+
rubygems_version: 1.8.15
|
108
106
|
signing_key:
|
109
107
|
specification_version: 3
|
110
108
|
summary: Mongo backend for qu
|