bumbleworks 0.0.83 → 0.0.84

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: bbe5633b5e019dd963d0fd388f304e1805749ed2
4
- data.tar.gz: cc10cc123580d14e05df088b012d0c989555d5fb
3
+ metadata.gz: ee8d2ad3b662fe678ac16e38fd28847a385b331a
4
+ data.tar.gz: 6e8fc9542f1ca3fe22dae925c96edd40bebbe7db
5
5
  SHA512:
6
- metadata.gz: 7bdb8d8622de7bc9c31134407c538bd7b6a980f38c3cdd9d9f06acab52069c795967be856817cd662e648aee0f7ea3093e5284c54f5682f0faa6e5ab8a5c215b
7
- data.tar.gz: 43fc6230d31fe63671d94d9bdf8166f9ac81210fe4a267958fab676f3aea5046f5476776eada5969234d1ea1bbb7bf296309a8b91b6b3653979d42b2a04647fa
6
+ metadata.gz: 887061ad9278d5db0775685a0ee0cd5e413a0e8aba80c879e528c1e4765151a5fbe1bcb4856c9cefc27f23aa5da20044471a7b2f772504eb2edcce192b02c8b8
7
+ data.tar.gz: 0fa2619b89743344d3caa2fed6df968122c4a16196830cded4e1f41c5ea3f660b78872a1f6f972aeedf59d2cb2750b5145c5cbc69f85cbcea5b64c353f5c793a
@@ -1,3 +1,3 @@
1
1
  module Bumbleworks
2
- VERSION = "0.0.83"
2
+ VERSION = "0.0.84"
3
3
  end
@@ -7,11 +7,14 @@ class Bumbleworks::Worker < Ruote::Worker
7
7
 
8
8
  class << self
9
9
  def info
10
- Bumbleworks.dashboard.worker_info
10
+ Bumbleworks.dashboard.worker_info || {}
11
11
  end
12
12
 
13
13
  def shutdown_all(options = {})
14
+ # First, send all running workers a message to stop
14
15
  change_worker_state('stopped', options)
16
+ # Now ensure that future started workers will be started
17
+ # in "running" mode instead of automatically stopped
15
18
  change_worker_state('running', options)
16
19
  end
17
20
 
@@ -24,7 +27,7 @@ class Bumbleworks::Worker < Ruote::Worker
24
27
  end
25
28
 
26
29
  def worker_states
27
- Bumbleworks.dashboard.worker_info.inject({}) { |hsh, info|
30
+ info.inject({}) { |hsh, info|
28
31
  id, state = info[0], info[1]['state']
29
32
  if state && state != 'stopped'
30
33
  hsh[id] = state
@@ -47,6 +50,7 @@ class Bumbleworks::Worker < Ruote::Worker
47
50
 
48
51
  def purge_worker_info(&block)
49
52
  doc = Bumbleworks.dashboard.storage.get('variables', 'workers')
53
+ return unless doc
50
54
  doc['workers'] = doc['workers'].reject { |id, info|
51
55
  block.call(id, info)
52
56
  }
@@ -50,6 +50,11 @@ describe Bumbleworks::Worker do
50
50
  allow(Bumbleworks.dashboard).to receive(:worker_info).and_return(:bontron)
51
51
  expect(described_class.info).to eq(:bontron)
52
52
  end
53
+
54
+ it 'returns empty hash if worker_info is nil' do
55
+ allow(Bumbleworks.dashboard).to receive(:worker_info).and_return(nil)
56
+ expect(described_class.info).to eq({})
57
+ end
53
58
  end
54
59
 
55
60
  describe '.forget_worker' do
@@ -77,6 +82,13 @@ describe Bumbleworks::Worker do
77
82
  described_class.refresh_worker_info
78
83
  expect(Time.parse(subject.info['put_at'])).to be_within(1).of(Time.now)
79
84
  end
85
+
86
+ it 'returns without issue if info empty' do
87
+ allow(described_class).to receive(:info).and_return({})
88
+ expect {
89
+ described_class.refresh_worker_info
90
+ }.not_to raise_error
91
+ end
80
92
  end
81
93
 
82
94
  describe '.purge_stale_worker_info' do
@@ -91,6 +103,12 @@ describe Bumbleworks::Worker do
91
103
  subject.id => subject_info
92
104
  })
93
105
  end
106
+
107
+ it 'returns without issue if no workers' do
108
+ doc = Bumbleworks.dashboard.storage.get('variables', 'workers')
109
+ Bumbleworks.dashboard.storage.delete(doc)
110
+ described_class.purge_stale_worker_info
111
+ end
94
112
  end
95
113
 
96
114
  describe '.change_worker_state' do
@@ -115,6 +133,13 @@ describe Bumbleworks::Worker do
115
133
  expect(subject.state).to eq('paused')
116
134
  expect(workers.map(&:state)).to eq(['stopped', 'stopped'])
117
135
  end
136
+
137
+ it 'does nothing if no worker info' do
138
+ allow(described_class).to receive(:info).and_return({})
139
+ expect {
140
+ described_class.change_worker_state('paused')
141
+ }.not_to raise_error
142
+ end
118
143
  end
119
144
  end
120
145
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bumbleworks
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.83
4
+ version: 0.0.84
5
5
  platform: ruby
6
6
  authors:
7
7
  - Maher Hawash
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2014-08-11 00:00:00.000000000 Z
14
+ date: 2014-08-12 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: ruote