deimos-ruby 1.1.0.pre.beta1 → 1.1.0.pre.beta2
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 +4 -4
- data/CHANGELOG.md +4 -0
- data/Gemfile.lock +1 -1
- data/lib/deimos/active_record_consumer.rb +1 -1
- data/lib/deimos/version.rb +1 -1
- data/spec/active_record_consumer_spec.rb +7 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 66e879a3dd314b2291d62b45044cc909173a4a91f72b3f749114c525f53a8eaf
|
4
|
+
data.tar.gz: e5b4c2c22d3392f97991675825ed4aa0ede4f78164aaf1385c5850f5c77403d0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5cb509aacf5c75c7b9be9ffd9fc6e9d2e52f5a7351dfeefd8bf7e6a5a76b795985ab08bbfe5330f2a1917859bd6f82d3a5df750c972e30b39db3df7cd47289fd
|
7
|
+
data.tar.gz: c8c7f1380c021ca4e991b507cc859e848dc3eb07d6af5fb2fad76bfb8c4560cd08e9aa9337450a1f597dcbbb620db3546125127ee11c137ef164ce3621de50b2
|
data/CHANGELOG.md
CHANGED
@@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
7
7
|
|
8
8
|
## UNRELEASED
|
9
9
|
|
10
|
+
# [1.1.0-beta2] - 2019-09-11
|
11
|
+
- Fixed bug where ActiveRecordConsumer was not using `unscoped` to update
|
12
|
+
via primary key and causing duplicate record errors.
|
13
|
+
|
10
14
|
# [1.1.0-beta1] - 2019-09-10
|
11
15
|
- Added BatchConsumer.
|
12
16
|
|
data/Gemfile.lock
CHANGED
@@ -17,7 +17,7 @@ module Deimos
|
|
17
17
|
def consume(payload, metadata)
|
18
18
|
key = metadata.with_indifferent_access[:key]
|
19
19
|
klass = self.class.config[:record_class]
|
20
|
-
record = klass.where(klass.primary_key => key).first
|
20
|
+
record = klass.unscoped.where(klass.primary_key => key).first
|
21
21
|
if payload.nil?
|
22
22
|
destroy_record(record)
|
23
23
|
return
|
data/lib/deimos/version.rb
CHANGED
@@ -17,6 +17,7 @@ module ActiveRecordProducerTest
|
|
17
17
|
|
18
18
|
# :nodoc:
|
19
19
|
class Widget < ActiveRecord::Base
|
20
|
+
default_scope -> { where(some_bool: false) }
|
20
21
|
end
|
21
22
|
Widget.reset_column_information
|
22
23
|
end
|
@@ -55,8 +56,12 @@ module ActiveRecordProducerTest
|
|
55
56
|
expect(widget.test_id).to eq('abc')
|
56
57
|
expect(widget.some_int).to eq(3)
|
57
58
|
expect(widget.some_datetime_int).to eq(Time.zone.now)
|
59
|
+
expect(widget.some_bool).to eq(false)
|
58
60
|
expect(widget.updated_at).to eq(Time.zone.now)
|
59
61
|
|
62
|
+
# test unscoped
|
63
|
+
widget.update_attribute(:some_bool, true)
|
64
|
+
|
60
65
|
# test update
|
61
66
|
test_consume_message(MyConsumer, {
|
62
67
|
test_id: 'abcd',
|
@@ -64,7 +69,8 @@ module ActiveRecordProducerTest
|
|
64
69
|
some_datetime_int: Time.zone.now.to_i,
|
65
70
|
timestamp: 2.minutes.ago.to_s
|
66
71
|
}, { call_original: true, key: 5 })
|
67
|
-
|
72
|
+
expect(Widget.unscoped.count).to eq(1)
|
73
|
+
widget = Widget.unscoped.last
|
68
74
|
expect(widget.id).to eq(5)
|
69
75
|
expect(widget.test_id).to eq('abcd')
|
70
76
|
expect(widget.some_int).to eq(3)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: deimos-ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.0.pre.
|
4
|
+
version: 1.1.0.pre.beta2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Daniel Orner
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-09-
|
11
|
+
date: 2019-09-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: avro-patches
|