statsig 1.8.1.beta.1 → 1.8.4.beta.pre.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/lib/statsig.rb +1 -1
  3. data/lib/statsig_logger.rb +18 -5
  4. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 85cc5f1ff296df6832034a396c9e575cd21e54502cff95467c691289143d0067
4
- data.tar.gz: a3ca082effe4a16dde1e73b700c30322db55a00e3e8f384015ae8d22640e41f8
3
+ metadata.gz: 8bea35d8e01c06aa973c41af533542e10256eb12ff1b8c790affe92d28e6f762
4
+ data.tar.gz: 183446325403fc29ffafd0ea498557ae56c59d6959a59d5e96a1c88806b57147
5
5
  SHA512:
6
- metadata.gz: 182507d8e780f6d37f0f94fe5e2183ad0c1fb8f6500ea8271203df45debcfa00a9630e03670a2e82e010aa77f41abb1d3d38ca5067c7e5df88dbf697c7aa7716
7
- data.tar.gz: de3029066c82f7886a55a0c0beecddd65751ebc337d3a6138ccb437c5ba506a4e238f55cca1e301530a4168dd126ea2fba833dfe8af70cc2936bbe7c72f68f3f
6
+ metadata.gz: 116a1a145265084de0877fda45b017f36eda5eed8a19c093e25588e1f4720ac10ef903dfdc9c6f13ae4989565a8b01e4e20ac2aa3efd661a34e1c16bb91d680b
7
+ data.tar.gz: aa0d99ff3b38ae0e73f037bf31efc4a364fe0e6831efa6347329f525e38c2148837c19e21768fece6b921fbbe6404664e30d9549aa9d4ace4544519c5830dd8b
data/lib/statsig.rb CHANGED
@@ -40,7 +40,7 @@ module Statsig
40
40
  def self.get_statsig_metadata
41
41
  {
42
42
  'sdkType' => 'ruby-server',
43
- 'sdkVersion' => '1.8.1.beta.1',
43
+ 'sdkVersion' => '1.8.4.beta-2',
44
44
  }
45
45
  end
46
46
 
@@ -8,14 +8,12 @@ module Statsig
8
8
  def initialize(network)
9
9
  @network = network
10
10
  @events = []
11
- @background_flush = Thread.new do
12
- sleep 60
13
- flush
14
- end
11
+ @background_flush = periodic_flush
15
12
  end
16
13
 
17
14
  def log_event(event)
18
15
  @events.push(event)
16
+ puts "Statsig:: log_event called, new count: #{@events.length.to_s}"
19
17
  if @events.length >= 500
20
18
  flush
21
19
  end
@@ -46,13 +44,28 @@ module Statsig
46
44
  log_event(event)
47
45
  end
48
46
 
47
+ def periodic_flush
48
+ puts "Statsig:: starting a thread"
49
+ Thread.new do
50
+ loop do
51
+ puts "Statsig:: beginning to sleep for 60 seconds"
52
+ sleep 60
53
+ puts "Statsig:: finished sleeping"
54
+ flush
55
+ puts "Statsig:: flushed"
56
+ end
57
+ end
58
+ end
59
+
49
60
  def flush(closing = false)
61
+ puts "Statsig:: calling flush function, count: #{@events.length.to_s}"
50
62
  if closing
51
- @background_flush.exit
63
+ @background_flush&.exit
52
64
  end
53
65
  if @events.length == 0
54
66
  return
55
67
  end
68
+ puts "Statsig:: flushing events, count: #{@events.length.to_s}"
56
69
  flush_events = @events.map { |e| e.serialize }
57
70
  @events = []
58
71
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: statsig
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.8.1.beta.1
4
+ version: 1.8.4.beta.pre.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Statsig, Inc
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-01-12 00:00:00.000000000 Z
11
+ date: 2022-01-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler