porpoise 0.9.4 → 0.9.5

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f9c9fb178689e3d75dd5d7a2ddebcca83d20dc56
4
- data.tar.gz: 749a0a5962cd8f37179f2e2eee29ceb595799bd1
3
+ metadata.gz: 40868f5a0247e5e68c4b732ebe99cbc152fe8135
4
+ data.tar.gz: 99d9476f9696789601c1ec97512d65563ccb5aeb
5
5
  SHA512:
6
- metadata.gz: 1d55e8404beff9282361c901e822a76051583f88c6448d26a0d3ffd75bd6c20d3b2dafc4f5d29aa9fa550f8fd53dd6c26f904039503c20123ba09ce7281bd25c
7
- data.tar.gz: '009bbfa5f4e889ba6a73521e7db653a9b1eb0bf3de124e1507cdbf178244cc59dd4dcc968208c8aba78558b272d4be4393ffb0a14e57e5097f42e7c55b96ff4b'
6
+ metadata.gz: 764eae754b33e385e158eed973dec7b70be44a3e83f64c8374632309b3c0a5d82309e6c65d19018ec5c7d1e40de2eb24bf0ee16d0dcf7e13190072a330deb0b4
7
+ data.tar.gz: 32f0697bd15f52bc2408876ce2b3f1a2f53b0937a5e30a693784c3fcf6b247a002a6442aa1ad76b7166d94103b74c7702696fc2e11d2abb51933dd3be89002c2
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ..
3
3
  specs:
4
- porpoise (0.9.3)
4
+ porpoise (0.9.4)
5
5
  activerecord (>= 3.2)
6
6
  activesupport (>= 3.2)
7
7
  rails (>= 3.2)
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ..
3
3
  specs:
4
- porpoise (0.9.3)
4
+ porpoise (0.9.4)
5
5
  activerecord (>= 3.2)
6
6
  activesupport (>= 3.2)
7
7
  rails (>= 3.2)
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ..
3
3
  specs:
4
- porpoise (0.9.3)
4
+ porpoise (0.9.4)
5
5
  activerecord (>= 3.2)
6
6
  activesupport (>= 3.2)
7
7
  rails (>= 3.2)
@@ -18,17 +18,24 @@ module ActiveSupport
18
18
 
19
19
  def cleanup(options = nil)
20
20
  short_mem_reset
21
- Porpoise::KeyValueObject.where(["`key` LIKE ?", "#{@namespace}:%"]).
22
- where(["expiration_date IS NOT NULL AND expiration_date < ?", Time.now]).
23
- delete_all
24
-
25
-
21
+
22
+ Porpoise::KeyValueObject.retry_lock_error(20) do
23
+ Porpoise::KeyValueObject.where(["`key` LIKE ?", "#{@namespace}:%"]).
24
+ where(["expiration_date IS NOT NULL AND expiration_date < ?", Time.now]).
25
+ pluck(:key).
26
+ in_groups_of(150) do |object_keys|
27
+
28
+ Porpoise::KeyValueObject.where(key: object_keys).delete_all
29
+ end
30
+ end
26
31
  end
27
32
 
28
33
  def clear(options = nil)
29
34
  short_mem_reset
30
35
  Porpoise::KeyValueObject.retry_lock_error(20) do
31
- Porpoise::KeyValueObject.where(["`key` LIKE ?", "#{@namespace}:%"]).delete_all
36
+ Porpoise::KeyValueObject.where(["`key` LIKE ?", "#{@namespace}:%"]).pluck(:key).in_groups_of(150) do |object_keys|
37
+ Porpoise::KeyValueObject.where(key: object_keys).delete_all
38
+ end
32
39
  end
33
40
  end
34
41
 
@@ -22,7 +22,9 @@ module Porpoise
22
22
  def del_matched(matcher)
23
23
  matcher = Porpoise::key_with_namespace(matcher.gsub("*", "%"))
24
24
  Porpoise::KeyValueObject.retry_lock_error(20) do
25
- Porpoise::KeyValueObject.not_expired.where(["`key` LIKE ?", matcher]).delete_all
25
+ Porpoise::KeyValueObject.not_expired.where(["`key` LIKE ?", matcher]).pluck(:key).in_groups_of(150) do |object_keys|
26
+ Porpoise::KeyValueObject.where(key: object_keys).delete_all
27
+ end
26
28
  end
27
29
  end
28
30
 
@@ -44,10 +44,6 @@ class Porpoise::KeyValueObject < ActiveRecord::Base
44
44
  else
45
45
  raise e
46
46
  end
47
- rescue ActiveRecord::TransactionIsolationConflict
48
- if retries.nil? || retries > 0
49
- retry_lock_error(retries ? retries - 1 : nil, &block)
50
- end
51
47
  end
52
48
  end
53
49
 
@@ -1,3 +1,3 @@
1
1
  module Porpoise
2
- VERSION = "0.9.4"
2
+ VERSION = "0.9.5"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: porpoise
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.4
4
+ version: 0.9.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Wessel van Heerde