refried 0.0.6.pre.rc1 → 0.0.6.pre.rc2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/refried/configuration.rb +2 -0
- data/lib/refried/getter.rb +5 -2
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 20fe2f675b9a874c5917941bac07ba3dc85d7c4c
|
4
|
+
data.tar.gz: 3c0847e9b5d44cf17abfeacc53a8a40782c2ac6b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 90c8ef84383c91a9334f3137b4a768e6f1ac71b018b911089be7de12087eda5372dfec6d2cabe6cf5132da12bab95ead64add5db2e5e2000139b4ec1db06bbba
|
7
|
+
data.tar.gz: 8870630b48b6152c7d6a235aa97f51dee3b9b568f3ac4752ac3a7262b22e05df096c3b1c08cb921cb0bac540226975dcb08e4f2b466afd889cc1392de2267f90
|
@@ -5,9 +5,11 @@ module Refried
|
|
5
5
|
PRIORITY_LABELS = { :high => 0, :medium => 100, :low => 200 }
|
6
6
|
|
7
7
|
attr_accessor :beanstalk_url # beanstalk url connection
|
8
|
+
attr_accessor :reserve_timeout # duration to wait to reserve on a single server
|
8
9
|
|
9
10
|
def initialize
|
10
11
|
@beanstalk_url = "localhost"
|
12
|
+
@reserve_timeout = nil
|
11
13
|
end
|
12
14
|
end # Configuration
|
13
15
|
end # Refried
|
data/lib/refried/getter.rb
CHANGED
@@ -48,10 +48,13 @@ module Refried
|
|
48
48
|
|
49
49
|
# Get a the next job from the tube
|
50
50
|
#
|
51
|
+
# @param timeout [Integer] Number of seconds before timing out
|
52
|
+
# @param block [Proc] Callback to perform on reserved job
|
51
53
|
# @return [Beanstalk::Job] the next job from the tube
|
52
|
-
def get
|
54
|
+
def get(timeout=nil, &block)
|
55
|
+
timeout ||= ::Refried.configuration.reserve_timeout
|
53
56
|
tube = ::Refried.tubes.find self.getter_tube_name.to_s
|
54
|
-
tube.reserve
|
57
|
+
tube.reserve timeout, &block
|
55
58
|
end
|
56
59
|
|
57
60
|
protected
|