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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b9cb2755df1f6588b130a9171d427a54301e7e5258d6f414d8e9950393b0a361
4
- data.tar.gz: dc475fcb4e450a693501b6c3a148c93dec90e0c40212e40de991e2aa7b8afb4f
3
+ metadata.gz: 66e879a3dd314b2291d62b45044cc909173a4a91f72b3f749114c525f53a8eaf
4
+ data.tar.gz: e5b4c2c22d3392f97991675825ed4aa0ede4f78164aaf1385c5850f5c77403d0
5
5
  SHA512:
6
- metadata.gz: 8b7594655e6051986ddc55efc7a5df32fafd3e445324b8d2592eeb406cbf607cf401b6c6ab9c4d7c76d6d8cfa3c8890d47400231dec15f330dbffb0341644a59
7
- data.tar.gz: bc909ec5cb051ee58e6f7840a1d191e9881f72e3442d9eba35be14e28fada2ff070f318fd5d73d46eca3bdc05f7ed05e0b0ac4d8a98f8ff4f29377854dd129ca
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
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- deimos-ruby (1.1.0.pre.beta1)
4
+ deimos-ruby (1.1.0.pre.beta2)
5
5
  avro-patches (~> 0.3)
6
6
  avro_turf (~> 0.8)
7
7
  phobos (~> 1.8.2.pre.beta2)
@@ -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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Deimos
4
- VERSION = '1.1.0-beta1'
4
+ VERSION = '1.1.0-beta2'
5
5
  end
@@ -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
- widget = Widget.last
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.beta1
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-10 00:00:00.000000000 Z
11
+ date: 2019-09-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: avro-patches