delayed 2.0.0 → 2.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a42f2f7d06ec85c051b3a72e7e8644a750e703e6994cd89e75b151e098810fde
4
- data.tar.gz: 122a0e93f5790543eca0484c27f52eff1472f693d1c8eee5c0aef27e1cace575
3
+ metadata.gz: b69cac642b56964d70aba6e210125180c11fcd690ffe666a6501db5f5cc52779
4
+ data.tar.gz: 6a2aca999b32ec0d2fb28fde33bb57725085c090eb6f2bcee29e50baa8f66a6f
5
5
  SHA512:
6
- metadata.gz: 2238ccb8c25ef5e483faf3a6bfa43f1c72a2b81e2cd5312071d8dbc72ef96397e3b6dceaac61db962028524e9a6b06769005ce64e9a5a1b7b818a81a40554c95
7
- data.tar.gz: b255dee5f83ffe62155edaf65e552a3f6042656b60515b7721a0707ff78c2ed8f284d5e298b9448c2ee34cb8d574447619f9e78ec92da5f1dee461f4ebbe4b70
6
+ metadata.gz: d74267db864b39c8861136fc374a392608f08b47400cc872adfc5c19cc4188be202a4f6e68354f370987f56c9f5f7f9221432358c0a4663021b1718e18703127
7
+ data.tar.gz: ac7f99b72554e9ec1ad69ecace6f637bd9aec6d6f4a74034030962ffc0542b3761542622775f52225e762ab248ef9e57a691b07852a16673574998fdb0099585
@@ -8,6 +8,11 @@ module Delayed
8
8
  delegate :concurrent_index_creation_supported?, to: :class
9
9
  end
10
10
 
11
+ def exec_migration(...)
12
+ @migration_start = Delayed::Job.db_time_now
13
+ super
14
+ end
15
+
11
16
  module ClassMethods
12
17
  def concurrent_index_creation_supported?
13
18
  connection.index_algorithms.key?(:concurrently)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Delayed
4
- VERSION = '2.0.0'
4
+ VERSION = '2.0.1'
5
5
  end
@@ -0,0 +1,67 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'helper'
4
+
5
+ describe Delayed::Helpers::Migration do
6
+ let(:migration_class) do
7
+ Class.new(ActiveRecord::Migration[6.0]) do
8
+ include Delayed::Helpers::Migration
9
+
10
+ attr_accessor :migration_start
11
+
12
+ def connection
13
+ ActiveRecord::Base.connection
14
+ end
15
+
16
+ def reversible
17
+ direction = Object.new
18
+ def direction.up
19
+ yield if block_given?
20
+ end
21
+
22
+ def direction.down
23
+ yield if block_given?
24
+ end
25
+ yield direction
26
+ end
27
+ end
28
+ end
29
+
30
+ let(:migration) { migration_class.new }
31
+
32
+ before do
33
+ migration.migration_start = Delayed::Job.db_time_now
34
+ end
35
+
36
+ describe '#with_retry_loop timeout tracking' do
37
+ it 'raises exception when wait_timeout is exceeded based on @migration_start' do
38
+ # Simulate migration that started 6 minutes ago
39
+ migration.migration_start = Delayed::Job.db_time_now - 6.minutes
40
+
41
+ expect {
42
+ migration.with_retry_loop(wait_timeout: 5.minutes) do
43
+ raise ActiveRecord::LockWaitTimeout
44
+ end
45
+ }.to raise_error(ActiveRecord::LockWaitTimeout)
46
+ end
47
+
48
+ it 'continues retrying while within the timeout window' do
49
+ call_count = 0
50
+
51
+ # First retry is within timeout, second exceeds it
52
+ allow(Delayed::Job).to receive(:db_time_now).and_return(
53
+ migration.migration_start + 4.minutes, # Within timeout
54
+ migration.migration_start + 6.minutes, # Exceeds timeout
55
+ )
56
+
57
+ expect {
58
+ migration.with_retry_loop(wait_timeout: 5.minutes) do
59
+ call_count += 1
60
+ raise ActiveRecord::LockWaitTimeout
61
+ end
62
+ }.to raise_error(ActiveRecord::LockWaitTimeout)
63
+
64
+ expect(call_count).to eq(2)
65
+ end
66
+ end
67
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: delayed
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0
4
+ version: 2.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nathan Griffith
@@ -19,7 +19,7 @@ authors:
19
19
  autorequire:
20
20
  bindir: bin
21
21
  cert_chain: []
22
- date: 2025-12-19 00:00:00.000000000 Z
22
+ date: 2026-01-05 00:00:00.000000000 Z
23
23
  dependencies:
24
24
  - !ruby/object:Gem::Dependency
25
25
  name: activerecord
@@ -108,6 +108,7 @@ files:
108
108
  - spec/delayed/__snapshots__/job_spec.rb.snap
109
109
  - spec/delayed/__snapshots__/monitor_spec.rb.snap
110
110
  - spec/delayed/active_job_adapter_spec.rb
111
+ - spec/delayed/helpers/migration_spec.rb
111
112
  - spec/delayed/job_spec.rb
112
113
  - spec/delayed/monitor_spec.rb
113
114
  - spec/delayed/plugins/instrumentation_spec.rb
@@ -160,6 +161,7 @@ test_files:
160
161
  - spec/delayed/__snapshots__/job_spec.rb.snap
161
162
  - spec/delayed/__snapshots__/monitor_spec.rb.snap
162
163
  - spec/delayed/active_job_adapter_spec.rb
164
+ - spec/delayed/helpers/migration_spec.rb
163
165
  - spec/delayed/job_spec.rb
164
166
  - spec/delayed/monitor_spec.rb
165
167
  - spec/delayed/plugins/instrumentation_spec.rb