resque-durable 4.1.1 → 4.3.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: 6257d429be895292fae5ae5671c60007004e73eb6aa7f613a6d2b4e9c72383fc
4
- data.tar.gz: baeeae3c5132d0603855ff487154e43cb139818d9c1d60e4193a8f9f70dd0a33
3
+ metadata.gz: 3b31b7b0781f9cb6c1656223ea92e19a91c8adf0b44e00b43ec25d5232b1bfe1
4
+ data.tar.gz: ac4249059fc80d52b0cc0b52e70dac2d02e02d4caebe2751ccc392023bfb2cb1
5
5
  SHA512:
6
- metadata.gz: 5619f9f0ae64d8d54f25d833007c6b759308f4583de9b9aea322c28bd892fdc66f6ab8d3dff525d4073c2407e29a2bc60cb0e305c33b7fdd055064e430a25054
7
- data.tar.gz: 7bad321f2c25e99b1bb0b95297afa541fca42823402d104a6c2dd23d9e2b2d1f19ff2d052a6f6b88c960cc76bb887db17709762e3cdaaa16140b254f490496a8
6
+ metadata.gz: f538d30e05c5c5e9046147a563a0aa4979d7db02f1de863056648b598c5c2bb0803ed2077b39561bf503272a1c4c5904095e4446510b0824e2dad56298d90e46
7
+ data.tar.gz: 6142d38af805e1f6983f37d690d64332e1c7f84730ee13ae633869feeeb278233fc24aac008f87e1f843e82043925c11bec8dc7c192a27cb3f717906f5bea320
@@ -37,7 +37,7 @@ module Resque
37
37
  @queue_audit.logger.error("Exception in BackgroundHeartbeat thread: #{e.class.name}: #{e.message}")
38
38
  self.class.exit_now!
39
39
  ensure
40
- ActiveRecord::Base.clear_active_connections!
40
+ ActiveRecord::Base.connection_handler.clear_active_connections!
41
41
  end
42
42
 
43
43
  def start!
@@ -3,36 +3,42 @@ require 'active_support/core_ext'
3
3
 
4
4
  module Resque
5
5
  module Durable
6
- class QueueAudit < ActiveRecord::Base
6
+ module QueueAuditMethods
7
+ extend ActiveSupport::Concern
8
+
7
9
  JobCollision = Class.new(StandardError)
8
10
 
9
- self.table_name = :durable_queue_audits
10
- # id
11
- # enqueued_id
12
- # queue_name
13
- # payload
14
- # enqueue_count
15
- # enqueued_at
16
- # completed_at
17
- # timeout_at
18
- # updated_at
19
- # created_at
20
- DEFAULT_DURATION = 10.minutes
11
+ included do
12
+ self.table_name = :durable_queue_audits
13
+ # id
14
+ # enqueued_id
15
+ # queue_name
16
+ # payload
17
+ # enqueue_count
18
+ # enqueued_at
19
+ # completed_at
20
+ # timeout_at
21
+ # updated_at
22
+ # created_at
21
23
 
22
- validates_inclusion_of :duration, :in => 1.minute.to_i..3.hours.to_i
24
+ validates_inclusion_of :duration, :in => 1.minute.to_i..3.hours.to_i
23
25
 
24
- scope :older_than, ->(date) { where('created_at < ?', date).limit(10000) }
26
+ scope :older_than, ->(date) { where('created_at < ?', date).limit(10000) }
25
27
 
26
- scope :failed, -> {
27
- where(completed_at: nil)
28
- .where('timeout_at < ?', Time.now.utc)
29
- .order('timeout_at asc')
30
- .limit(500)
31
- }
28
+ scope :failed, -> {
29
+ where(completed_at: nil)
30
+ .where('timeout_at < ?', Time.now.utc)
31
+ .order('timeout_at asc')
32
+ .limit(500)
33
+ }
32
34
 
33
- scope :complete, -> { where('completed_at is not null') }
35
+ scope :complete, -> { where('completed_at is not null') }
36
+ end
34
37
 
35
- module Recovery
38
+ class_methods do
39
+ def initialize_by_klass_and_args(job_klass, args)
40
+ new(:job_klass => job_klass, :payload => args, :enqueued_id => GUID.generate)
41
+ end
36
42
 
37
43
  def recover
38
44
  failed.each do |audit|
@@ -48,12 +54,6 @@ module Resque
48
54
  def cleanup(date)
49
55
  older_than(date).delete_all
50
56
  end
51
-
52
- end
53
- extend Recovery
54
-
55
- def self.initialize_by_klass_and_args(job_klass, args)
56
- new(:job_klass => job_klass, :payload => args, :enqueued_id => GUID.generate)
57
57
  end
58
58
 
59
59
  def job_klass
@@ -0,0 +1,5 @@
1
+ module Resque
2
+ module Durable
3
+ VERSION = "4.3.0"
4
+ end
5
+ end
@@ -1,8 +1,9 @@
1
+ require_relative 'durable/queue_audit_methods'
2
+
1
3
  module Resque
2
4
  module Durable
3
5
  autoload :GUID, 'resque/durable/guid'
4
6
  autoload :Monitor, 'resque/durable/monitor'
5
- autoload :QueueAudit, 'resque/durable/queue_audit'
6
7
  autoload :BackgroundHeartbeat, 'resque/durable/background_heartbeat'
7
8
 
8
9
  def self.extended(base)
@@ -86,6 +87,10 @@ module Resque
86
87
  @requeue_immediately = true
87
88
  end
88
89
 
90
+ def disable_requeue_immediately
91
+ @requeue_immediately = false
92
+ end
93
+
89
94
  def build_audit(args)
90
95
  auditor.initialize_by_klass_and_args(self, args)
91
96
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: resque-durable
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.1.1
4
+ version: 4.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eric Chapweske
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2023-09-29 00:00:00.000000000 Z
12
+ date: 2024-08-13 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activerecord
@@ -17,14 +17,14 @@ dependencies:
17
17
  requirements:
18
18
  - - ">="
19
19
  - !ruby/object:Gem::Version
20
- version: '5.2'
20
+ version: '6.1'
21
21
  type: :runtime
22
22
  prerelease: false
23
23
  version_requirements: !ruby/object:Gem::Requirement
24
24
  requirements:
25
25
  - - ">="
26
26
  - !ruby/object:Gem::Version
27
- version: '5.2'
27
+ version: '6.1'
28
28
  - !ruby/object:Gem::Dependency
29
29
  name: resque
30
30
  requirement: !ruby/object:Gem::Requirement
@@ -77,7 +77,8 @@ files:
77
77
  - lib/resque/durable/background_heartbeat.rb
78
78
  - lib/resque/durable/guid.rb
79
79
  - lib/resque/durable/monitor.rb
80
- - lib/resque/durable/queue_audit.rb
80
+ - lib/resque/durable/queue_audit_methods.rb
81
+ - lib/resque/durable/version.rb
81
82
  homepage: https://github.com/zendesk/resque-durable
82
83
  licenses:
83
84
  - MIT
@@ -90,14 +91,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
90
91
  requirements:
91
92
  - - ">="
92
93
  - !ruby/object:Gem::Version
93
- version: '2.7'
94
+ version: '3.1'
94
95
  required_rubygems_version: !ruby/object:Gem::Requirement
95
96
  requirements:
96
97
  - - ">="
97
98
  - !ruby/object:Gem::Version
98
99
  version: '0'
99
100
  requirements: []
100
- rubygems_version: 3.0.3.1
101
+ rubygems_version: 3.3.26
101
102
  signing_key:
102
103
  specification_version: 4
103
104
  summary: Resque queue backed by database audits, with automatic retry