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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9e9aebb60664b45a63f42cd3c2ac7609210f7d82d226b4e74ce254f9cf37c055
4
- data.tar.gz: 55d9625c5c8ea1591c47c0e3b05230e9c0639c74b036f1098a6a624832d6475b
3
+ metadata.gz: 00d61af52d2ce2df71518dfde99d8c43a93dbbbfc67bd6cbd704e867fdab01a5
4
+ data.tar.gz: 8cc688a68449e504f6e0a2ad6a6b34fdc8106260aca27d0fcf9a63b5f2a412b3
5
5
  SHA512:
6
- metadata.gz: 91dd8d0ca28b56a527bddec23cfb0a61f27ee46b1b21c6559a4e02558d955a46c4b52b372897ac5d462bf1a86574823927daa0e096c802ed4f1ccf4ccc9f01e2
7
- data.tar.gz: 7d68c6ba7110d839a233f47f4504e66d04565f3b9e916abc9dbe10faddc52e2d1fed1959400e804bc5699305cde7b6088578940a84c40bb00585763b1a0c3cd2
6
+ metadata.gz: e9346c7e618a4ea5ebbbd9666cd5bc2426b60ae0a8c968cde9a43ea891befddc55f610997a86f05eafd7ab158bb513b9b0e0dfe32a7ed567f2ab0197bfec9e2c
7
+ data.tar.gz: '08d6c3d16ae63e44a48de030b623fde95e6f0f587d30c0a76cd033199e8c89bee16055c42f16a4730033abaaddbca4bda21679e62d8694f312e784eec4ec85fe'
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ class AddDeleteAfterExecution < ActiveRecord::Migration[5.0]
4
+
5
+ def change
6
+ add_column :cuetip_jobs, :delete_after_execution, :boolean, default: false
7
+ end
8
+
9
+ end
@@ -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).destroy_all
76
+ Models::Job.where('created_at < ?', before).delete_all
71
77
  end
72
78
  end
73
79
 
@@ -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
- self.finished_at = Time.now
129
- save!
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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Cuetip
4
- VERSION = '1.3.1'
4
+ VERSION = '1.4.0'
5
5
  end
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.3.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-18 00:00:00.000000000 Z
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