resque-durable 4.1.0 → 4.2.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: 06e9f2c661904146837eb00fb32749a8b98f97d5b0823ade9f4d5728415dd296
4
- data.tar.gz: 65eb84b6a2cde6fd3aaafe3bee4168a61ab8bfb1837f01b61759f9895970adf9
3
+ metadata.gz: 760558bccac1af452b42796868cdbda6a57b3354df3741cc33f005d34f4fd2cc
4
+ data.tar.gz: 1683df8484d77ef28c279b4ed7e7231685c84885f0eef64e89a0c914355a319f
5
5
  SHA512:
6
- metadata.gz: 2fa7e0802df25c44b81a8e38ac019a33a3479d08fbeed792204d8d1e173618cbe898d45ae08f0b3abf43e9018d831b07207b47740b5fc3ae369a2b55f94739a8
7
- data.tar.gz: 5c90519a2aaee23758d39d0cab29d6108a8b0d639b4ba151b003ee0e5b2e9c0f95a4628a5a973124091b33f0ae66415884552b9807143481c7e1b53984c69b56
6
+ metadata.gz: 3d11699c2d98c648c69cf514b535bd2ef6f8f04197bb6e1732d613b474ecf6bf4ff1e5bcc8392d7ff687e078a7670690cfe3d97b62acce5a3b6c38845bff09f3
7
+ data.tar.gz: 8d94395d6e1413a0052d8a68126bbc70470826e1e2833b12a718497f596469d0c4f576df30eb5fda45838fd15be9ae068a181480a42d0b5ca6d8b0b026fe21c2
@@ -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.2.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.0
4
+ version: 4.2.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-06-27 00:00:00.000000000 Z
12
+ date: 2024-08-01 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activerecord
@@ -17,26 +17,26 @@ 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
31
31
  requirements:
32
- - - "~>"
32
+ - - ">="
33
33
  - !ruby/object:Gem::Version
34
34
  version: '1.27'
35
35
  type: :runtime
36
36
  prerelease: false
37
37
  version_requirements: !ruby/object:Gem::Requirement
38
38
  requirements:
39
- - - "~>"
39
+ - - ">="
40
40
  - !ruby/object:Gem::Version
41
41
  version: '1.27'
42
42
  - !ruby/object:Gem::Dependency
@@ -57,16 +57,16 @@ dependencies:
57
57
  name: redis
58
58
  requirement: !ruby/object:Gem::Requirement
59
59
  requirements:
60
- - - "<"
60
+ - - ">="
61
61
  - !ruby/object:Gem::Version
62
- version: '5'
62
+ version: '0'
63
63
  type: :runtime
64
64
  prerelease: false
65
65
  version_requirements: !ruby/object:Gem::Requirement
66
66
  requirements:
67
- - - "<"
67
+ - - ">="
68
68
  - !ruby/object:Gem::Version
69
- version: '5'
69
+ version: '0'
70
70
  description:
71
71
  email:
72
72
  executables: []
@@ -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