logstash-mixin-scheduler 1.0.0-java → 1.0.1-java

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: 67978c6a1909fafc833c6b6ad0ea257274a7c6e9ae05dfd7c06e1a2b3d6820d0
4
- data.tar.gz: cf0dada853778214e4bef783d356f921e0d153557912a6a00c787270decfaefe
3
+ metadata.gz: 7387c2af32713b46fd61936cfbe11854f3fdeaccb5c885d5acd0924eb69c3f66
4
+ data.tar.gz: cce64f89163bdd5a2b117e9fcfa7fb6fe61286bbe5156ed2572ea24147cee129
5
5
  SHA512:
6
- metadata.gz: db8106c162a7268c40c3bfde3f7ee888d002238a9081f94eb294fa23af97eb687502a7243fd79b4e12c006574324bc1815b114966af43e42d73a837c7a4e3816
7
- data.tar.gz: 0caadfd21d2b8e49f51b2b77cc3858423b0ec7fb21ba5aeab0839e2c17d308de34ecdcdea93e26e15cbc09b4bfccc435f5a05182e93a34eac5f69c3b019247a2
6
+ metadata.gz: 6da2594d0a2a09cba10bbac71bc675e51a48e1bd0f8f9be615f20f6db85ffebce72a5e325f0e0642f7c1f5511b683ee975256ac6a25649ab3181e78459d34dbe
7
+ data.tar.gz: 7b372d338d17aae260ff8a89ab2f5070d38e54ab50fa2d1f6e708dc2c77b16ad2f124714704d4f4fdca63bf036f0e69b4a4010c682a0f29d3095c69811da35a2
data/CHANGELOG.md CHANGED
@@ -1,2 +1,5 @@
1
+ ## 1.0.1
2
+ - Refactor: initialize time zone data eagerly [#2](https://github.com/logstash-plugins/logstash-mixin-scheduler/pull/2)
3
+
1
4
  ## 1.0.0
2
5
  - Feat: a common scheduler interface [#1](https://github.com/logstash-plugins/logstash-mixin-scheduler/pull/1)
@@ -1,5 +1,11 @@
1
1
  require 'rufus/scheduler'
2
-
2
+ begin
3
+ require 'et-orbi.rb' # a dependency of rufus-scheduler since 3.4
4
+ ::EtOrbi::EoTime.now # might take a long time to initialize - loading time zone
5
+ # data (from tz-info) and thus gets un-predictable on CI, since the scheduler worker
6
+ # thread might be stuck starting while we attempt to shutdown in a given time frame
7
+ rescue LoadError
8
+ end
3
9
  require 'logstash/util/loggable'
4
10
 
5
11
  module LogStash module PluginMixins module Scheduler module RufusImpl
@@ -7,7 +7,7 @@ describe LogStash::PluginMixins::Scheduler::RufusImpl do
7
7
  let(:name) { '[test]<jdbc_scheduler' }
8
8
 
9
9
  let(:opts) do
10
- { :max_work_threads => 2 }
10
+ { max_work_threads: 2, frequency: 0.2 }
11
11
  end
12
12
 
13
13
  subject(:scheduler) do
@@ -83,7 +83,10 @@ describe LogStash::PluginMixins::Scheduler::RufusImpl do
83
83
  let(:counter) { java.util.concurrent.atomic.AtomicLong.new(0) }
84
84
 
85
85
  before do
86
- scheduler.cron('* * * * * *') { counter.increment_and_get; sleep 3.25 } # every second
86
+ scheduler.cron('* * * * * *') do # every second
87
+ counter.increment_and_get
88
+ sleep_at_least 3.25
89
+ end
87
90
  end
88
91
 
89
92
  it "are working" do
@@ -102,4 +105,17 @@ describe LogStash::PluginMixins::Scheduler::RufusImpl do
102
105
 
103
106
  end
104
107
 
108
+ private
109
+
110
+ # with multiple threads on JRuby 9.3 -> some tend to finish 'early'
111
+ def sleep_at_least(time)
112
+ start = Time.now
113
+ slept = 0
114
+ while slept < time
115
+ sleep(time - slept)
116
+ slept = Time.now - start
117
+ end
118
+ slept
119
+ end
120
+
105
121
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: logstash-mixin-scheduler
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: java
6
6
  authors:
7
7
  - Elastic
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-06-07 00:00:00.000000000 Z
11
+ date: 2022-06-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  requirement: !ruby/object:Gem::Requirement