redact 0.1.2 → 0.1.3

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.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/redact.rb +8 -4
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: aee51358dbb8a6851e198db0b85821c751eadd91
4
- data.tar.gz: a9ff5586c8a2ff9fdb6963667e7d8bff592a088c
3
+ metadata.gz: 9f859024a006575309d7d616e5a1c996e5c1e79c
4
+ data.tar.gz: 6ef60e3ad77160e2d22a1d538f71f10be6043962
5
5
  SHA512:
6
- metadata.gz: d4a3c90d19c30edbb81eadb2b293262f8f4e6b985fc548365b2331945199d19ee14e5b05711ca616557a480bf1b3154f457791d1047c726cf13b2196849eae86
7
- data.tar.gz: 63cbccbaf00f39fb0a8327c9dec9a5582fbde539aae6678368e128292bc32e6bb77852f51af7d005b428928c2f83fe60c5e21d2d08bfd03aa771723b0c906bbe
6
+ metadata.gz: 68805e7ee55892d4898e57ee98fb51307297090b7b4de6d444c98f21c05a3e388cb301b54bd6394e2ef3accf4594f5dc46f38f439836b143dcf6e5245b7b5ba5
7
+ data.tar.gz: 77ad7358b7ce73b0f90397c4fbf4a69842f2d1bdeeba74fa1346241e005c7ac17b594cfbd74d6832635e4ef6e25bb9732a62eedc48a6dd526a1428da9d0944a6
@@ -151,18 +151,22 @@ class Redact
151
151
  ##
152
152
  ## +opts+ are:
153
153
  ## * +blocking+: if true, #each will block until items are available (and will never return)
154
+ ## * +block_timeout+: when +blocking+ is true, the timeout (in seconds) before stopping. A value of nil or 0 will block forever.
154
155
  ## * +retries+: how many times an individual job should be retried before resulting in an error state. Default is 2 (so 3 tries total).
155
156
  ## * +worker_id+: the id of this worker process, for debugging. (If nil, will use a reasonably intelligent default.)
156
157
  def each opts={}
157
158
  worker_id = opts[:worker_id] || [Socket.gethostname, $$, $0].join("-")
158
159
  retries = opts[:retries] || 2
159
160
  blocking = opts[:blocking]
161
+ block_timeout = opts[:block_timeout] || 0
160
162
 
161
163
  while true
162
- ## get the token of the next task to perform
163
- meth = blocking ? :brpoplpush : :rpoplpush
164
- token = @redis.send meth, @queue, @processing_list
165
- break unless token # no more tokens and we're in non-blocking mode
164
+ token = if blocking
165
+ @redis.brpoplpush @queue, @processing_list, block_timeout
166
+ else
167
+ @redis.rpoplpush @queue, @processing_list
168
+ end
169
+ break unless token # no more tokens!
166
170
 
167
171
  ## decompose the token
168
172
  task, target, run_id, insertion_time = parse_token token
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: redact
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - William Morgan
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-10-06 00:00:00.000000000 Z
11
+ date: 2014-10-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: trollop