table_sync 4.1.0 → 4.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: d6b452885641883758a131ec14f3a9aa2f8508bb1c3a540b8e78c727a8d86a88
4
- data.tar.gz: efd055d98480febde524af5af5db5cfefde1b534a5fa40d7b8cb696ac11432ba
3
+ metadata.gz: 5c2a571110c8f306d04bcfb7b796a511b0b78d951228d9d09f7e9c85b10f704a
4
+ data.tar.gz: e69f07af2fbfee19655edd291c78f4c22773aa602d1e5c06b1ccde4b1a6d1cfb
5
5
  SHA512:
6
- metadata.gz: bd98bc390f5d04625d98c9c5fac179a9b588830210502727288b74c46f4badf4a177afbcbe02b67bd33cdd7ba8ed7d3fea593e3893e5519f5d2c40c01f3a454e
7
- data.tar.gz: 230f6a412f0d2d55750a4d1edb75b5c9605730de1c6352d5e5d1e8b4375ed16081fe296f70ace3dff65b54d5b85bc1a18a153119d8a6f7c1994289d5170ddc80
6
+ metadata.gz: 4f8e01507a1ad943aa26f08d667869d80c2154bd4c0effe8de25b3ca4698cd4b7af67a741fbb81875f7dbc3f45f082ca04abb43a41aa35d340e6409858f5503b
7
+ data.tar.gz: a931a4d842586f703730c96c90bae10b43cea362e17d45ca4c62d27185306e9fc7cdcf18ac6c209c0ecb38ff6f4dc3f38415c1487cad6eea2a3be095c8cede72
@@ -1,6 +1,10 @@
1
1
  # Changelog
2
2
  All notable changes to this project will be documented in this file.
3
3
 
4
+ ## [4.1.1] - 2020-11-06
5
+ ### Fixed
6
+ - dead locks in receiving module (see: `spec/receiving/handler_spec.rb#avoid dead locks`)
7
+
4
8
  ## [4.1.0] - 2020-11-02
5
9
  ### Changed
6
10
  - move `TableSync::Instrument.notify` from models to the handler
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- table_sync (4.1.0)
4
+ table_sync (4.1.1)
5
5
  memery
6
6
  rabbit_messaging (~> 0.3)
7
7
  rails
@@ -23,6 +23,8 @@ class TableSync::Receiving::Handler < Rabbit::EventHandler
23
23
 
24
24
  validate_data(data, target_keys: target_keys)
25
25
 
26
+ data.sort_by! { |row| row.values_at(*target_keys) }
27
+
26
28
  params = { data: data, target_keys: target_keys, version_key: version_key }
27
29
 
28
30
  if event == :update
@@ -53,16 +55,20 @@ class TableSync::Receiving::Handler < Rabbit::EventHandler
53
55
  end
54
56
 
55
57
  def configs
56
- @configs ||= self.class.configs[model]&.map do |config|
57
- ::TableSync::Receiving::ConfigDecorator.new(
58
- config: config,
59
- # next parameters will be send to each proc-options from config
60
- event: event,
61
- model: model,
62
- version: version,
63
- project_id: project_id,
64
- raw_data: data,
65
- )
58
+ @configs ||= begin
59
+ configs = self.class.configs[model]
60
+ configs = configs.sort_by { |config| "#{config.model.schema}.#{config.model.table}" }
61
+ configs.map do |config|
62
+ ::TableSync::Receiving::ConfigDecorator.new(
63
+ config: config,
64
+ # next parameters will be send to each proc-options from config
65
+ event: event,
66
+ model: model,
67
+ version: version,
68
+ project_id: project_id,
69
+ raw_data: data,
70
+ )
71
+ end
66
72
  end
67
73
  end
68
74
 
@@ -99,9 +105,7 @@ class TableSync::Receiving::Handler < Rabbit::EventHandler
99
105
  end
100
106
 
101
107
  if data.uniq { |row| row.slice(*target_keys) }.size != data.size
102
- raise TableSync::DataError.new(
103
- data, target_keys, "Duplicate rows found!"
104
- )
108
+ raise TableSync::DataError.new(data, target_keys, "Duplicate rows found!")
105
109
  end
106
110
  end
107
111
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module TableSync
4
- VERSION = "4.1.0"
4
+ VERSION = "4.1.1"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: table_sync
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.1.0
4
+ version: 4.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Umbrellio
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-11-03 00:00:00.000000000 Z
11
+ date: 2020-11-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: memery