ruote-ar 0.0.14 → 0.0.16

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/ruote/ar/storage.rb +3 -9
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d64ffb7cb111a0d9c00a7f815ee5f04df9160349
4
- data.tar.gz: f52106125bb89b301673c239de8f4d58e731af68
3
+ metadata.gz: 1e0241507f892fff44c2ebdaf0d9d9c9e44b944a
4
+ data.tar.gz: 0de91883cd70078a934cb5f574d894e889e99568
5
5
  SHA512:
6
- metadata.gz: 33be828e28671f0e83efbdd47b16948ac6f90fdfa96fb93e25a70cb7b4e80273c63970d80ea753f513b4406a331dd747c3db553a4191cb55ad37010ffcbe5692
7
- data.tar.gz: 1b73c6f25e2bb5b3e8a7d227513c656121c7096b1c727f2324065be4958ffdd6e1a4c2be750c9d961e280ba327852a533d47c1852ae12dd84ab83fa6c6a3f850
6
+ metadata.gz: 47fbd6cad6db3761cf3333dc03ae57e77b54c1b5a1f93f02171adbbdd5c7fb01f2b3999785b8462efffc6418707300f5a9595e9f6e09f52d9958ee42229e781b
7
+ data.tar.gz: 3cd4e2c7e841552352d763f6f7e8e0d8ff2eb2c7ce04bdb845e3341e76d66d26302699e303b03ccec70889e0d31dc528dd0474bc5e1a5c4d398865ac1e48f9d7
@@ -34,10 +34,6 @@ module Ruote
34
34
  # return true if the update was affected more than one line.
35
35
  #
36
36
  def reserve(doc)
37
- # doc is already this worker
38
- return true if !doc['_worker'].nil? && doc['_worker'] == @worker
39
-
40
- # try reserve this document
41
37
  um = Arel::UpdateManager.new Arel::Table.engine
42
38
  um.table table
43
39
  um.where table[:typ].eq(doc['type'].to_s).
@@ -134,8 +130,8 @@ module Ruote
134
130
 
135
131
  keys = key ? Array(key) : nil
136
132
  ds = ds.and(table[:wfid].in(keys)) if keys && keys.first.is_a?(String)
137
- ds = ds.and(table[:worker].eq(nil).or(table[:worker].eq(@worker))) if type == 'msgs'
138
-
133
+ ds = ds.and(table[:worker].eq(nil)) if type == 'msgs'
134
+
139
135
  ds = table.where(ds)
140
136
 
141
137
  return connection.select_value(ds.project(table[:wfid].count)) if opts[:count]
@@ -154,9 +150,7 @@ module Ruote
154
150
 
155
151
  docs = connection.select_all(ds.project('*'))
156
152
  docs = select_last_revs(docs)
157
-
158
- # TIP: append worker info to doc to use in reserve
159
- docs = docs.collect { |d| Rufus::Json.decode(d['doc']).merge({'_worker' => d['worker']}) }
153
+ docs = docs.collect { |d| Rufus::Json.decode(d['doc']) }
160
154
 
161
155
  if keys && keys.first.is_a?(Regexp)
162
156
  docs.select { |doc| keys.find { |k| k.match(doc['_id']) } }
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruote-ar
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.14
4
+ version: 0.0.16
5
5
  platform: ruby
6
6
  authors:
7
7
  - pedroteixeira