catpm 0.1.1 → 0.1.2

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: 80833151768ee8663ecdc42bb19ce005192b6abbc79265c07f72d64420b150c2
4
- data.tar.gz: 6cae1efcb3da09ed873f023889c25d817b340c2dd6fa164ce40653ee72b29cd0
3
+ metadata.gz: 2a84d81e5f4bbf2dca6af9f3b1c91d18af2160e9a15e24c8093216be4b8c5e20
4
+ data.tar.gz: 347b9026049cb39becf4d7618996c3091ddc0243115efdf47e689c644ec03f89
5
5
  SHA512:
6
- metadata.gz: 84a7e308da71bd80521ccf6469973b15f23280aae9852b2fe6fea2905cd95edd9772c7844e697f9afcfac748f579299a0a0ffeb761cae23620c2b7ebc2a83356
7
- data.tar.gz: 75b72fd288be8eb1001d5e4586a5034c34880926233b9863d22cb84e7616924319b6517d3acb0874439f4fd94bad6109d3a24610643ef5661cbc844caf1d6fb7
6
+ metadata.gz: da7474f427ad062a4cad9098263adacc90df2835cc8e2425689363346e805ca3fa520870fe2366cb750ea0f47bb3579adc06872891c413a2bcb9bd9222467278
7
+ data.tar.gz: a1161b1475b8c45654a6e0833cc1884686adaf2bdb1de5293c8337085e5e290503399053a19d2c3d2ce1fce2c79cc7ec0b31ea5d0e31207ffaff3a32ce50710b
data/lib/catpm/flusher.rb CHANGED
@@ -1,7 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'concurrent'
4
-
5
3
  module Catpm
6
4
  class Flusher
7
5
  attr_reader :running
@@ -13,26 +11,29 @@ module Catpm
13
11
  @circuit = CircuitBreaker.new
14
12
  @last_cleanup_at = Time.now
15
13
  @running = false
16
- @timer = nil
14
+ @thread = nil
17
15
  end
18
16
 
19
17
  def start
20
18
  return if @running
21
19
 
22
20
  @running = true
23
- @timer = Concurrent::TimerTask.new(
24
- execution_interval: effective_interval,
25
- run_now: false
26
- ) { flush_cycle }
27
- @timer.execute
21
+ @thread = Thread.new do
22
+ while @running
23
+ sleep(effective_interval)
24
+ flush_cycle if @running
25
+ end
26
+ rescue => e
27
+ Catpm.config.error_handler.call(e)
28
+ retry if @running
29
+ end
28
30
  end
29
31
 
30
32
  def stop(timeout: Catpm.config.shutdown_timeout)
31
33
  return unless @running
32
34
 
33
35
  @running = false
34
- @timer&.shutdown
35
- @timer&.wait_for_termination(timeout)
36
+ @thread&.join(timeout)
36
37
  flush_cycle # Final flush
37
38
  end
38
39
 
data/lib/catpm/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Catpm
4
- VERSION = '0.1.1'
4
+ VERSION = '0.1.2'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: catpm
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - ''