flipper 0.26.0.rc1 → 0.26.0.rc2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/flipper/adapters/poll/poller.rb +16 -14
- data/lib/flipper/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 60ce7896afa06dd25ad8e6f8b4f419bbb992e16ce7147339af30ac15f338871d
|
4
|
+
data.tar.gz: 3a6635db6af529d29a2f1bd075fe45a82c77211bdd012d3613a89f2b98566975
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6ce977a03bcafdfd4cb0427541eb0277b4dfbbadd723c86e12a7fcbec65d398663ed74fbdb9c46aa6b460e00e0025bd9853ed52c7a3cf3f44016e005d79e6eff
|
7
|
+
data.tar.gz: c422114b0e7076ebd7c0c63bef943a54aede502f253c5310a4e59f17daaadeafd435594aac7936c441adfc3a39fa3d5ba2ef17c589d828cefb5a977d750f0215
|
@@ -7,9 +7,7 @@ module Flipper
|
|
7
7
|
module Adapters
|
8
8
|
class Poll
|
9
9
|
class Poller
|
10
|
-
|
11
|
-
|
12
|
-
attr_reader :thread, :pid, :mutex, :logger, :interval, :last_synced_at
|
10
|
+
attr_reader :thread, :pid, :mutex, :interval, :last_synced_at
|
13
11
|
|
14
12
|
def self.instances
|
15
13
|
@instances ||= Concurrent::Map.new
|
@@ -29,14 +27,14 @@ module Flipper
|
|
29
27
|
@pid = Process.pid
|
30
28
|
@mutex = Mutex.new
|
31
29
|
@adapter = Memory.new
|
30
|
+
@instrumenter = options.fetch(:instrumenter, Instrumenters::Noop)
|
32
31
|
@remote_adapter = options.fetch(:remote_adapter)
|
33
|
-
@logger = options.fetch(:logger) { Logger.new(STDOUT) }
|
34
32
|
@interval = options.fetch(:interval, 10).to_f
|
35
33
|
@lock = Concurrent::ReadWriteLock.new
|
36
34
|
@last_synced_at = Concurrent::AtomicFixnum.new(0)
|
37
35
|
|
38
36
|
if @interval < 1
|
39
|
-
warn "
|
37
|
+
warn "Flipper::Cloud poll interval must be greater than or equal to 1 but was #{@interval}. Setting @interval to 1."
|
40
38
|
@interval = 1
|
41
39
|
end
|
42
40
|
|
@@ -57,7 +55,9 @@ module Flipper
|
|
57
55
|
end
|
58
56
|
|
59
57
|
def stop
|
60
|
-
|
58
|
+
@instrumenter.instrument("poller.#{InstrumentationNamespace}", {
|
59
|
+
operation: :stop,
|
60
|
+
})
|
61
61
|
@thread&.kill
|
62
62
|
end
|
63
63
|
|
@@ -66,15 +66,15 @@ module Flipper
|
|
66
66
|
sleep jitter
|
67
67
|
start = Concurrent.monotonic_time
|
68
68
|
begin
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
adapter.import(@remote_adapter)
|
69
|
+
@instrumenter.instrument("poller.#{InstrumentationNamespace}", operation: :poll) do
|
70
|
+
adapter = Memory.new
|
71
|
+
adapter.import(@remote_adapter)
|
73
72
|
|
74
|
-
|
75
|
-
|
73
|
+
@lock.with_write_lock { @adapter.import(adapter) }
|
74
|
+
@last_synced_at.update { |time| Concurrent.monotonic_time }
|
75
|
+
end
|
76
76
|
rescue => exception
|
77
|
-
|
77
|
+
# you can instrument these using poller.flipper
|
78
78
|
end
|
79
79
|
|
80
80
|
sleep_interval = interval - (Concurrent.monotonic_time - start)
|
@@ -103,7 +103,9 @@ module Flipper
|
|
103
103
|
begin
|
104
104
|
return if thread_alive?
|
105
105
|
@thread = Thread.new { run }
|
106
|
-
|
106
|
+
@instrumenter.instrument("poller.#{InstrumentationNamespace}", {
|
107
|
+
operation: :thread_start,
|
108
|
+
})
|
107
109
|
ensure
|
108
110
|
mutex.unlock
|
109
111
|
end
|
data/lib/flipper/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: flipper
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.26.0.
|
4
|
+
version: 0.26.0.rc2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- John Nunemaker
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-11-
|
11
|
+
date: 2022-11-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: concurrent-ruby
|