picky 4.12.12 → 4.12.13

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. data/lib/picky/backends/redis.rb +4 -21
  2. metadata +3 -3
@@ -190,15 +190,6 @@ module Picky
190
190
  #
191
191
  ids combinations, amount, offset
192
192
  end
193
-
194
- # # TODO
195
- # #
196
- # def add id, str_or_sym, weight_strategy, similarity_strategy, where
197
- #
198
- #
199
- # weight = weight_strategy.weight_for ids.size
200
- # similar = similarity_strategy.encode str_or_sym
201
- # end
202
193
 
203
194
  # Generate a multiple host/process safe result id.
204
195
  #
@@ -235,7 +226,7 @@ module Picky
235
226
  if identifiers.size > 1
236
227
  # Reuse script already installed in Redis.
237
228
  #
238
- # Note: This may raise an error in Redis,
229
+ # Note: This raises an error in Redis,
239
230
  # when the script is not installed.
240
231
  #
241
232
  client.evalsha @ids_script_hash,
@@ -252,19 +243,11 @@ module Picky
252
243
  offset,
253
244
  (offset + amount)
254
245
  end
255
- rescue RuntimeError => e # Redis::CommandError
246
+ rescue ::Redis::CommandError => e
256
247
  # Install script in Redis.
257
248
  #
258
- # TODO Use SCRIPT LOAD, then retry?
259
- #
260
- @ids_script_hash = Digest::SHA1.hexdigest @ids_script
261
- client.eval @ids_script,
262
- identifiers,
263
- [
264
- generate_intermediate_result_id,
265
- offset,
266
- (offset + amount)
267
- ]
249
+ @ids_script_hash = client.script 'load', @ids_script
250
+ retry
268
251
  end
269
252
  end
270
253
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: picky
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.12.12
4
+ version: 4.12.13
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -34,7 +34,7 @@ dependencies:
34
34
  requirements:
35
35
  - - ~>
36
36
  - !ruby/object:Gem::Version
37
- version: 4.12.12
37
+ version: 4.12.13
38
38
  type: :development
39
39
  prerelease: false
40
40
  version_requirements: !ruby/object:Gem::Requirement
@@ -42,7 +42,7 @@ dependencies:
42
42
  requirements:
43
43
  - - ~>
44
44
  - !ruby/object:Gem::Version
45
- version: 4.12.12
45
+ version: 4.12.13
46
46
  - !ruby/object:Gem::Dependency
47
47
  name: text
48
48
  requirement: !ruby/object:Gem::Requirement