qu-mongo 0.1.3 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/qu/backend/mongo.rb +7 -3
- metadata +7 -7
data/lib/qu/backend/mongo.rb
CHANGED
@@ -10,9 +10,13 @@ module Qu
|
|
10
10
|
# Seconds to wait before try to reconnect after connection failure (default: 1)
|
11
11
|
attr_accessor :retry_frequency
|
12
12
|
|
13
|
+
# Seconds to wait before looking for more jobs when the queue is empty (default: 5)
|
14
|
+
attr_accessor :poll_frequency
|
15
|
+
|
13
16
|
def initialize
|
14
|
-
self.max_retries
|
17
|
+
self.max_retries = 5
|
15
18
|
self.retry_frequency = 1
|
19
|
+
self.poll_frequency = 5
|
16
20
|
end
|
17
21
|
|
18
22
|
def connection
|
@@ -74,7 +78,7 @@ module Qu
|
|
74
78
|
end
|
75
79
|
|
76
80
|
if options[:block]
|
77
|
-
sleep
|
81
|
+
sleep poll_frequency
|
78
82
|
else
|
79
83
|
break
|
80
84
|
end
|
@@ -142,7 +146,7 @@ module Qu
|
|
142
146
|
rescue ::Mongo::ConnectionFailure => ex
|
143
147
|
retries += 1
|
144
148
|
raise ex if retries > max_retries
|
145
|
-
sleep
|
149
|
+
sleep retry_frequency * retries
|
146
150
|
retry
|
147
151
|
end
|
148
152
|
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: 19
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 0.1.
|
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:
|
18
|
+
date: 2012-01-07 00:00:00 -05:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -40,12 +40,12 @@ dependencies:
|
|
40
40
|
requirements:
|
41
41
|
- - "="
|
42
42
|
- !ruby/object:Gem::Version
|
43
|
-
hash:
|
43
|
+
hash: 19
|
44
44
|
segments:
|
45
45
|
- 0
|
46
46
|
- 1
|
47
|
-
-
|
48
|
-
version: 0.1.
|
47
|
+
- 4
|
48
|
+
version: 0.1.4
|
49
49
|
type: :runtime
|
50
50
|
version_requirements: *id002
|
51
51
|
- !ruby/object:Gem::Dependency
|