timberline 0.8.4 → 0.8.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/timberline/version.rb +1 -1
- data/lib/timberline/worker.rb +29 -3
- metadata +3 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 6f3dfd9c720cbfdd13437a4f993314cc6bd1efd0
|
|
4
|
+
data.tar.gz: 711690699ad0b93354396aacb8d550d41759513e
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 9864cd6bd4aef55a8871f1e3cf7103c7ab42e8ec0e75552e3097a625852717f1f132a07477ff1c0ff522a05b83133e04d27dcfc576e3b3fc7a92f4f770f3077f
|
|
7
|
+
data.tar.gz: b3c073f280198da05af738b1a94d37187231e11795f534b5abfdb695a2b774fc40b601b89f1fd8b94fbc20caf14a237d09a728799cb067c7a6b727543847211e
|
data/lib/timberline/version.rb
CHANGED
data/lib/timberline/worker.rb
CHANGED
|
@@ -20,16 +20,24 @@ class Timberline
|
|
|
20
20
|
|
|
21
21
|
while(keep_watching?)
|
|
22
22
|
item = @queue.pop
|
|
23
|
+
@executing_job = true
|
|
23
24
|
item.started_processing_at = Time.now.to_f
|
|
24
25
|
|
|
25
26
|
begin
|
|
26
|
-
|
|
27
|
+
begin
|
|
28
|
+
process_item(item)
|
|
29
|
+
rescue StandardError => e
|
|
30
|
+
handle_process_exception(e, item)
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
item.finished_processing_at = Time.now.to_f
|
|
34
|
+
@queue.add_success_stat(item)
|
|
27
35
|
rescue ItemRetried, ItemErrored
|
|
28
36
|
next
|
|
37
|
+
ensure
|
|
38
|
+
@executing_job = false
|
|
29
39
|
end
|
|
30
40
|
|
|
31
|
-
item.finished_processing_at = Time.now.to_f
|
|
32
|
-
@queue.add_success_stat(item)
|
|
33
41
|
end
|
|
34
42
|
end
|
|
35
43
|
|
|
@@ -48,6 +56,24 @@ class Timberline
|
|
|
48
56
|
true
|
|
49
57
|
end
|
|
50
58
|
|
|
59
|
+
# Whether the worker is currently executing a job.
|
|
60
|
+
#
|
|
61
|
+
# @return [boolean]
|
|
62
|
+
def executing_job?
|
|
63
|
+
@executing_job == true
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
# Called when process_item has resulted in an exception. Exceptions are
|
|
67
|
+
# handled by default by reraising. This method is available to allow
|
|
68
|
+
# subclasses to override or extend how exceptions are handled. A subclass
|
|
69
|
+
# may, for example, want to log errors, handle specific error types in
|
|
70
|
+
# specific ways, or call error_item by default on all errors.
|
|
71
|
+
#
|
|
72
|
+
# @raise By default, raises the error it is provided.
|
|
73
|
+
def handle_process_exception(exception, item)
|
|
74
|
+
raise exception
|
|
75
|
+
end
|
|
76
|
+
|
|
51
77
|
# Given an item this worker is processing, have the queue mark it
|
|
52
78
|
# as fatally errored and raise an ItemErrored exception so that the
|
|
53
79
|
# watch loop can process it correctly
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: timberline
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.8.
|
|
4
|
+
version: 0.8.5
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Tommy Morgan
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2015-
|
|
11
|
+
date: 2015-10-22 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: redis
|
|
@@ -197,7 +197,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
197
197
|
version: '0'
|
|
198
198
|
requirements: []
|
|
199
199
|
rubyforge_project: timberline
|
|
200
|
-
rubygems_version: 2.2.
|
|
200
|
+
rubygems_version: 2.2.3
|
|
201
201
|
signing_key:
|
|
202
202
|
specification_version: 4
|
|
203
203
|
summary: Timberline is a simple and extensible queuing system built in Ruby and backed
|