deimos-ruby 1.18.0 → 1.18.2

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: 93b418353fa710fd90425980ec2772f6cb4249b1d4e43c3cadd9fb7a099eb387
4
- data.tar.gz: b319ef0e32b2e147b7ec0a3b131d8d8269e9818faa5313b6f56745498a2942c3
3
+ metadata.gz: a3f5f0c1fdba2cf641706b6c18733f433c04f42e3e06f5871ab0050a0215cc61
4
+ data.tar.gz: 9c758f1d7e62dd9cd91e1631b3211cc9388adb0bb7b3dfea7b29099b46224bc7
5
5
  SHA512:
6
- metadata.gz: 60bd9c6f8cb7e4a63d791312b2fb784cfed4f2b0c60f679d71f1fff1adeac8ca86cbf285e42bf24fb1e65748fe5c1a0127710925d068c5d6bf6feeb4753ed203
7
- data.tar.gz: 9e30a8666f75d62fcee4c5f99de3737af5b58c6bafc9c54f786784785472233dc6a9135c525b288d04320acb716b58274b9dcaeeba90965a04721e0e77588c83
6
+ metadata.gz: 30b074497e6efe25e87d6e4736ecba0725b5bb4b20dcfba9bc82a655c9ee246986b9a655ceeec05b6bfa57b0633fecafb3cf7e1335322bd40a4254b3d973944f
7
+ data.tar.gz: 798513006a509d7439e4d09c18a6a547bac683bcbb4a56013447fad59ba941702072f828d6ec8966da6fec8096659a686de7f796d858923e17fdcf7f21235318
data/CHANGELOG.md CHANGED
@@ -7,6 +7,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## UNRELEASED
9
9
 
10
+ # 1.18.2 - 2022-11-14
11
+
12
+ - Fixes bug related to wait between runs when no records are fetched by updating poll_info
13
+
14
+ # 1.18.1 - 2022-11-01
15
+
16
+ - Fix the primary_key detection way in `state_based` mode
17
+
10
18
  # 1.18.0 - 2022-11-01
11
19
 
12
20
  ### Features :star:
@@ -18,7 +18,10 @@ module Deimos
18
18
  loop do
19
19
  Deimos.config.logger.debug("Polling #{@producer.topic}, batch #{status.current_batch}")
20
20
  batch = fetch_results.to_a
21
- break if batch.empty?
21
+ if batch.empty?
22
+ @info.touch(:last_sent)
23
+ break
24
+ end
22
25
 
23
26
  success = process_batch_with_span(batch, status)
24
27
  finalize_batch(batch, success)
@@ -35,11 +38,11 @@ module Deimos
35
38
  # @param success [Boolean]
36
39
  # @return [void]
37
40
  def finalize_batch(batch, success)
38
- @info.touch
41
+ @info.touch(:last_sent)
39
42
 
40
43
  state = success ? @config.published_state : @config.failed_state
41
44
  klass = batch.first.class
42
- id_col = record.class.primary_key
45
+ id_col = klass.primary_key.to_sym
43
46
  timestamp_col = @config.timestamp_column
44
47
 
45
48
  attrs = { timestamp_col => Time.zone.now }
@@ -36,7 +36,10 @@ module Deimos
36
36
  loop do
37
37
  Deimos.config.logger.debug("Polling #{@producer.topic}, batch #{status.current_batch}")
38
38
  batch = fetch_results(time_from, time_to).to_a
39
- break if batch.empty?
39
+ if batch.empty?
40
+ @info.touch(:last_sent)
41
+ break
42
+ end
40
43
 
41
44
  process_and_touch_info(batch, status)
42
45
  time_from = last_updated(batch.last)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Deimos
4
- VERSION = '1.18.0'
4
+ VERSION = '1.18.2'
5
5
  end
@@ -333,6 +333,21 @@ each_db_config(Deimos::Utils::DbPoller::Base) do
333
333
  with('Poll my-topic-with-id complete at 2015-05-05 00:59:58 -0400 (3 batches, 0 errored batches, 7 processed messages)')
334
334
  end
335
335
 
336
+ it 'should update PollInfo timestamp after processing' do
337
+ poll_before = Deimos::PollInfo.last
338
+ poller.process_updates
339
+ poll_after = Deimos::PollInfo.last
340
+ expect(poll_after.last_sent).to be >= poll_before.last_sent
341
+ end
342
+
343
+ it 'should update PollInfo timestamp when there are no records to process' do
344
+ allow(poller).to receive(:fetch_results).and_return([])
345
+ poll_before = Deimos::PollInfo.last
346
+ poller.process_updates
347
+ poll_after = Deimos::PollInfo.last
348
+ expect(poll_after.last_sent).to be >= poll_before.last_sent
349
+ end
350
+
336
351
  describe 'errors' do
337
352
  before(:each) do
338
353
  poller.config.retries = 0
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.18.0
4
+ version: 1.18.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel Orner
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-11-01 00:00:00.000000000 Z
11
+ date: 2022-11-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: avro_turf