postburner 0.3.2 → 0.3.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +10 -0
- data/app/models/postburner/job.rb +40 -27
- data/lib/postburner/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4b21ae5985bd9458b91095fe9a40370c6efe0a2d1903be46b47a0785dc6e0f73
|
4
|
+
data.tar.gz: e7e3989d2805bc64815f6b586ba8e594b11963a7330e0d012a7671928b55576d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: af927556728f74e306075633a45851a51c4f26faa44f1c54901aa2c7a6f176e494b2c220d2040239e49c458a5cdc6c2e4ae19fd9d35548de1a2028f2a24c074a
|
7
|
+
data.tar.gz: 22d1b312e5b44a21b9035ecaf6a732aa6bac2100244144ed1084bf1f1d83f170df1f378f262fabdc1c8ec2edf26c2c97d4cfd94b006c27992a5871261f09bb4d
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,15 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## v0.3.3 - 2021-06-15
|
4
|
+
|
5
|
+
### Fixed
|
6
|
+
- re-raise exception after logging during perform.
|
7
|
+
- log but swallow post perform data update exceptions.
|
8
|
+
- only allow remove! if job still present.
|
9
|
+
|
10
|
+
### Added
|
11
|
+
- Job#log! and Job#log_exception! that save the data immediately.
|
12
|
+
|
3
13
|
## v0.3.2 - 2021-05-07
|
4
14
|
|
5
15
|
### Fixed
|
@@ -56,22 +56,19 @@ module Postburner
|
|
56
56
|
|
57
57
|
begin
|
58
58
|
if self.processed_at.present?
|
59
|
-
self.log "Already Processed", level: :error
|
60
|
-
update_column :logs, self.logs
|
59
|
+
self.log! "Already Processed", level: :error
|
61
60
|
self.delete!
|
62
61
|
return
|
63
62
|
end
|
64
63
|
|
65
64
|
if self.removed_at.present?
|
66
|
-
self.log "Removed", level: :error
|
67
|
-
update_column :logs, self.logs
|
65
|
+
self.log! "Removed", level: :error
|
68
66
|
return
|
69
67
|
end
|
70
68
|
|
71
69
|
if self.run_at && self.run_at > Time.zone.now
|
72
70
|
response = self.insert! delay: self.run_at - Time.zone.now
|
73
|
-
self.log "PREMATURE; RE-INSERTED: #{response}"
|
74
|
-
update_column :logs, self.logs
|
71
|
+
self.log! "PREMATURE; RE-INSERTED: #{response}"
|
75
72
|
return
|
76
73
|
end
|
77
74
|
|
@@ -81,26 +78,29 @@ module Postburner
|
|
81
78
|
|
82
79
|
self.log('DONE')
|
83
80
|
|
84
|
-
|
85
|
-
|
86
|
-
|
81
|
+
begin
|
82
|
+
now = Time.zone.now
|
83
|
+
_duration = (now - self.processing_at) * 1000 rescue nil
|
84
|
+
self.update_columns(
|
85
|
+
processed_at: now,
|
86
|
+
duration: _duration,
|
87
|
+
errata: self.errata,
|
88
|
+
error_count: self.errata.length,
|
89
|
+
logs: self.logs,
|
90
|
+
log_count: self.logs.length,
|
91
|
+
)
|
92
|
+
rescue Exception => e
|
93
|
+
self.log_exception!(e)
|
94
|
+
self.log! '[Postburner] Could not set data after processing.'
|
95
|
+
# TODO README doesn't retry if Postburner is to blame
|
96
|
+
end
|
87
97
|
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
processed_at: now,
|
93
|
-
duration: _duration,
|
94
|
-
errata: self.errata,
|
95
|
-
error_count: self.errata.length,
|
96
|
-
logs: self.logs,
|
97
|
-
log_count: self.logs.length,
|
98
|
-
)
|
99
|
-
rescue Exception => e
|
100
|
-
raise e if Rails.env.development? || Rails.env.production?
|
101
|
-
self.log_exception(e)
|
102
|
-
update_column :errata, self.errata
|
98
|
+
rescue Exception => exception
|
99
|
+
self.log_exception!(exception)
|
100
|
+
self.log! '[Postburner] Exception raised during perform prevented completion.'
|
101
|
+
raise exception
|
103
102
|
end
|
103
|
+
|
104
104
|
end
|
105
105
|
|
106
106
|
def delete!
|
@@ -122,9 +122,12 @@ module Postburner
|
|
122
122
|
end
|
123
123
|
|
124
124
|
def remove!
|
125
|
-
|
126
|
-
|
127
|
-
|
125
|
+
if self.beanstalk_job
|
126
|
+
self.delete!
|
127
|
+
self.update_column(:removed_at, Time.zone.now)
|
128
|
+
else
|
129
|
+
false
|
130
|
+
end
|
128
131
|
end
|
129
132
|
|
130
133
|
def beanstalk_job
|
@@ -152,6 +155,11 @@ module Postburner
|
|
152
155
|
]
|
153
156
|
end
|
154
157
|
|
158
|
+
def log_exception!(exception)
|
159
|
+
self.log_exception(exception)
|
160
|
+
self.update_column :errata, self.errata
|
161
|
+
end
|
162
|
+
|
155
163
|
def log(message, options={})
|
156
164
|
options[:level] ||= :info
|
157
165
|
options[:level] = :error unless LOG_LEVELS.member?(options[:level])
|
@@ -163,6 +171,11 @@ module Postburner
|
|
163
171
|
]
|
164
172
|
end
|
165
173
|
|
174
|
+
def log!(message, options={})
|
175
|
+
self.log(message, options)
|
176
|
+
self.update_column :logs, self.logs
|
177
|
+
end
|
178
|
+
|
166
179
|
private
|
167
180
|
|
168
181
|
def insert!(options={})
|
data/lib/postburner/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: postburner
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matt Smith
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-06-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|