nfagent 0.9.6 → 0.9.8

Sign up to get free protection for your applications and to get access to all the features.
data/lib/nfagent.rb CHANGED
@@ -30,5 +30,5 @@ require 'nfagent/server'
30
30
  require 'nfagent/cli'
31
31
 
32
32
  module NFAgent
33
- VERSION = '0.9.6'
33
+ VERSION = '0.9.8'
34
34
  end
@@ -6,7 +6,7 @@ module NFAgent
6
6
  proxy_class = Net::HTTP::Proxy(Config.proxy.host, Config.proxy.port, Config.proxy.user, Config.proxy.password)
7
7
  # TODO: Enable SSL
8
8
  proxy_class.start(SERVICE_HOST, 80) do |http|
9
- http.read_timeout = 240 # 4 minutes TODO: Make this a config option with 240 as default
9
+ http.read_timeout = 120 # 2 minutes TODO: Make this a config option with 120 as default
10
10
  req = Net::HTTP::Post.new("/#{end_point}")
11
11
  req.set_form_data(data_hash.merge("key" => Config.client_key))
12
12
  ClientResponse.new do |resp|
@@ -13,11 +13,7 @@ module NFAgent
13
13
  EM::PeriodicTimer.new(120) do
14
14
  poller.send_heartbeat
15
15
  end
16
- EM::fork_reactor do
17
- EM::PeriodicTimer.new(60) do
18
- Submitter.resubmit_failed_dumps
19
- end
20
- end
16
+ Submitter.run_every(60)
21
17
  }
22
18
  end
23
19
 
@@ -22,6 +22,18 @@ module NFAgent
22
22
  end
23
23
  end
24
24
 
25
+ # Actually runs the submitter
26
+ # every 'seconds' seconds after
27
+ # the last one completes
28
+ def self.run_every(seconds)
29
+ callback = proc { run_every(seconds) }
30
+ EM::add_timer(seconds) do
31
+ EM::defer(nil, callback) do
32
+ resubmit_failed_dumps
33
+ end
34
+ end
35
+ end
36
+
25
37
  # TODO: Change attempt logic
26
38
  # Add the next timestamp for when submission should be attenpted again to the end of the filename
27
39
  def self.resubmit_failed_dumps
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 9
8
- - 6
9
- version: 0.9.6
8
+ - 8
9
+ version: 0.9.8
10
10
  platform: ruby
11
11
  authors:
12
12
  - Daniel Draper