activerecord-slotted_counters 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ff9187e867bfb86509d8303890fd3cdc1c93d0dc68463100bb43aafe2e15194d
4
- data.tar.gz: 72aabf239bfb85122e3691e80ef8e6cef238b0630b6b2355416f75482b571725
3
+ metadata.gz: 5dcee16f487cc8b48e6fb4c4b84069cc97b9647d5e710fa8d8c2e25038620815
4
+ data.tar.gz: 43b9d1432b7aa8088c1508038d8927cf4aca1e8e33e3a159a3b915b7037f8084
5
5
  SHA512:
6
- metadata.gz: 4bb48bae9e3567472423d670e9966c146f6004893cba795582a3e6f321ce8ce37c544d660b2b60480496dada50f04306a496fecfc454037ee6d013ca502d94ae
7
- data.tar.gz: 59907136fb20a46b843e6944243def5fbcca00ccbed312ba687ff880edb2adfdadbaca8dc3c0f399abe385ed4d8748864c3dbad5fefd804861ea88fd25e44630
6
+ metadata.gz: 9783f3d0166756156a12e2337539acca146ebb8cbec1298d3b3b06a8721c2a23c18e61bc38c2944cd2fb999f798129e30ef608c4f862fad4e3d7628573cd49d3
7
+ data.tar.gz: a6a250dd5daed59fd0495954c9220e02de57e99232d2e19f7e159d9f838d4ad6b2a90acc3ece9f466a829afc99467ec4ef096130827be9d3ba13197c665cb367
data/CHANGELOG.md CHANGED
@@ -2,9 +2,14 @@
2
2
 
3
3
  ## master
4
4
 
5
+ ## 0.1.1 (2023-01-17)
6
+
7
+ - Fix prevent double increment/decrement of native counter caches [#10](https://github.com/evilmartians/activerecord-slotted_counters/pull/10) ([@danielwestendorf][])
8
+
5
9
  ## 0.1.0 (2022-11-29)
6
10
 
7
11
  - Initial release.
8
12
 
9
13
  [@palkan]: https://github.com/palkan
10
14
  [@LukinEgor]: https://github.com/LukinEgor
15
+ [@danielwestendorf]: https://github.com/danielwestendorf
data/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  # Active Record slotted counters
4
4
 
5
- This gem adds **slotted counters** support to [Active Record counter cache][counter-cache]. Slotted counters help to reduce contention on a single row update in case you many concurrent operations (like updating a page views counter during traffic spikes).
5
+ This gem adds **slotted counters** support to [Active Record counter cache][counter-cache]. Slotted counters help to reduce contention on a single row update in case you have many concurrent operations (like updating a page views counter during traffic spikes).
6
6
 
7
7
  Read more about slotted counters in [this post](https://planetscale.com/blog/the-slotted-counter-pattern).
8
8
 
@@ -13,7 +13,7 @@ module ActiveRecordSlottedCounters
13
13
  module BelongsToAssociation
14
14
  def update_counters_via_scope(klass, foreign_key, by)
15
15
  counter_name = reflection.counter_cache_column
16
- super unless klass.registered_slotted_counter? counter_name
16
+ return super unless klass.registered_slotted_counter? counter_name
17
17
 
18
18
  klass.update_counters(foreign_key, counter_name => by, :touch => reflection.options[:touch])
19
19
  end
@@ -182,7 +182,7 @@ module ActiveRecordSlottedCounters
182
182
  end
183
183
 
184
184
  def increment!(attribute, by = 1, touch: nil)
185
- super unless self.class.registered_slotted_counter? attribute
185
+ return super unless self.class.registered_slotted_counter? attribute
186
186
 
187
187
  self.class.update_counters(id, attribute => by, :touch => touch)
188
188
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ActiveRecordSlottedCounters # :nodoc:
4
- VERSION = "0.1.0"
4
+ VERSION = "0.1.1"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: activerecord-slotted_counters
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Egor Lukin
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2022-11-29 00:00:00.000000000 Z
12
+ date: 2023-01-17 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activerecord