appsignal 0.8.12 → 0.8.13

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
  SHA1:
3
- metadata.gz: eba4ca3bafc6cb95c61c0135695eda9ada7a3128
4
- data.tar.gz: 5e89621bb70dfb4cdadde2f996e5d4d83ecab9a6
3
+ metadata.gz: d56f0e2c7ba6fbe1d96a774a8815a1380c58ef4a
4
+ data.tar.gz: 2fa915ae48dfab0388a99b1add175ec25922fcbf
5
5
  SHA512:
6
- metadata.gz: 113615a0525a2904cf5f6873032cc767bda1c842c1524383184dd722e27e3b01b41cda320b4497dd68d4119ff83303f43d55b169f8a3e58ff77f3d7be6d3b26a
7
- data.tar.gz: ea517cd6039e98f8cc62f26e5d6e43ef4bf97a1c444f71309652354173874facc9a98075d97ba989235ee6e45624fe7048c5c341b0b286c70e131ebb3c5cd8ee
6
+ metadata.gz: 6cb9285900da9c130e403b80bbdad656072b315ee4e04e469357a74d09e5008aedb4bda6966d3a7c44c8136a0eb8876583a788efe69970248647101ca785872a
7
+ data.tar.gz: d53de5f4a411ba6a663952a0b4d5a59f958550b918088dc90f56e398df9dcf3657b807d51f806e8de37967c4db8d1b8fa367574a1914b9592cc6dea26a2f3ec8
@@ -1,3 +1,6 @@
1
+ # 0.8.13
2
+ * Random sleep time before first transmission of queue
3
+
1
4
  # 0.8.12
2
5
  * Workaround for frozen string in Notification events
3
6
  * Require ActiveSupport::Notifications to be sure it's available
@@ -24,8 +24,8 @@ module Appsignal
24
24
  def start_thread
25
25
  Appsignal.logger.debug('Starting agent thread')
26
26
  @thread = Thread.new do
27
+ sleep(rand(sleep_time))
27
28
  loop do
28
- Appsignal.logger.debug aggregator.queue.inspect
29
29
  send_queue if aggregator.has_transactions?
30
30
  Appsignal.logger.debug("Sleeping #{sleep_time}")
31
31
  sleep(sleep_time)
@@ -1,3 +1,3 @@
1
1
  module Appsignal
2
- VERSION = '0.8.12'
2
+ VERSION = '0.8.13'
3
3
  end
@@ -32,16 +32,35 @@ describe Appsignal::Agent do
32
32
  describe "#start_thread" do
33
33
  before { subject.thread = nil }
34
34
 
35
- it "should start a background thread" do
36
- subject.start_thread
35
+ context "without transactions" do
36
+ it "should start and run a background thread" do
37
+ subject.should_not_receive(:send_queue)
37
38
 
38
- subject.thread.should be_a(Thread)
39
- subject.thread.should be_alive
39
+ subject.start_thread
40
+
41
+ subject.thread.should be_a(Thread)
42
+ subject.thread.should be_alive
43
+ end
44
+ end
45
+
46
+ context "with transactions" do
47
+ before do
48
+ subject.stub(
49
+ :aggregator => double(:has_transactions? => true),
50
+ :sleep_time => 0.1
51
+ )
52
+ end
53
+
54
+ it "should send the queue and sleep" do
55
+ subject.should_receive(:send_queue).at_least(:twice)
56
+
57
+ subject.start_thread
58
+ sleep 1
59
+ end
40
60
  end
41
61
  end
42
62
 
43
63
  describe "#restart_thread" do
44
-
45
64
  it "should stop thread" do
46
65
  subject.should_receive(:stop_thread)
47
66
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: appsignal
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.12
4
+ version: 0.8.13
5
5
  platform: ruby
6
6
  authors:
7
7
  - Robert Beekman