cuetip 1.3.1 → 1.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/db/migrate/20201211104200_add_delete_after_execution.rb +9 -0
- data/lib/cuetip/job.rb +7 -1
- data/lib/cuetip/models/job.rb +10 -2
- data/lib/cuetip/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 00d61af52d2ce2df71518dfde99d8c43a93dbbbfc67bd6cbd704e867fdab01a5
|
4
|
+
data.tar.gz: 8cc688a68449e504f6e0a2ad6a6b34fdc8106260aca27d0fcf9a63b5f2a412b3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e9346c7e618a4ea5ebbbd9666cd5bc2426b60ae0a8c968cde9a43ea891befddc55f610997a86f05eafd7ab158bb513b9b0e0dfe32a7ed567f2ab0197bfec9e2c
|
7
|
+
data.tar.gz: '08d6c3d16ae63e44a48de030b623fde95e6f0f587d30c0a76cd033199e8c89bee16055c42f16a4730033abaaddbca4bda21679e62d8694f312e784eec4ec85fe'
|
data/lib/cuetip/job.rb
CHANGED
@@ -41,6 +41,12 @@ module Cuetip
|
|
41
41
|
end
|
42
42
|
attr_writer :delay_execution
|
43
43
|
|
44
|
+
# Should this job be deleted after execution
|
45
|
+
def delete_after_execution
|
46
|
+
@delete_after_execution || false
|
47
|
+
end
|
48
|
+
attr_writer :delete_after_execution
|
49
|
+
|
44
50
|
# Queue this job
|
45
51
|
#
|
46
52
|
# @param params [Hash]
|
@@ -67,7 +73,7 @@ module Cuetip
|
|
67
73
|
#
|
68
74
|
# @param before [ActiveSupport::TimeWithZone] The point in time to prune jobs until.
|
69
75
|
def prune(before)
|
70
|
-
Models::Job.where('created_at < ?', before).
|
76
|
+
Models::Job.where('created_at < ?', before).delete_all
|
71
77
|
end
|
72
78
|
end
|
73
79
|
|
data/lib/cuetip/models/job.rb
CHANGED
@@ -50,6 +50,12 @@ module Cuetip
|
|
50
50
|
queued_job&.destroy
|
51
51
|
self.queued_job = nil
|
52
52
|
log 'Removed from queue'
|
53
|
+
|
54
|
+
if delete_after_execution?
|
55
|
+
destroy
|
56
|
+
log 'Removed job from database'
|
57
|
+
end
|
58
|
+
|
53
59
|
end
|
54
60
|
|
55
61
|
# Log some text about this job
|
@@ -125,8 +131,10 @@ module Cuetip
|
|
125
131
|
false
|
126
132
|
end
|
127
133
|
ensure
|
128
|
-
|
129
|
-
|
134
|
+
unless destroyed?
|
135
|
+
self.finished_at = Time.now
|
136
|
+
save!
|
137
|
+
end
|
130
138
|
Cuetip.config.emit(:finished, self, job_klass)
|
131
139
|
log 'Finished processing'
|
132
140
|
end
|
data/lib/cuetip/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cuetip
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Adam Cooke
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-11
|
11
|
+
date: 2020-12-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|
@@ -51,6 +51,7 @@ files:
|
|
51
51
|
- db/migrate/20180104161110_create_cuetip_queued_jobs_table.rb
|
52
52
|
- db/migrate/20180104161500_create_cuetip_job_queue_table.rb
|
53
53
|
- db/migrate/20190314172700_increase_size_of_cuetip_job_exception_backtrace.rb
|
54
|
+
- db/migrate/20201211104200_add_delete_after_execution.rb
|
54
55
|
- lib/cuetip.rb
|
55
56
|
- lib/cuetip/config.rb
|
56
57
|
- lib/cuetip/engine.rb
|