online_migrations 0.31.0 → 0.31.2

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: '0872638ad98f95ef8fa347b719f14d548fec58402dd8fc6a06702c9d884f9346'
4
- data.tar.gz: 572c037d2bf35cf048b8e1ee45fb0e464d375a3adec18264ba3e8f78b5cd433b
3
+ metadata.gz: 4afb5d9ab9916861d263de3c38a2436d2ee131ae9988edf282866145a274356d
4
+ data.tar.gz: 761d30f417479db296429af0668bf62e47581aa4a73fce1d9ba72bd62c66173f
5
5
  SHA512:
6
- metadata.gz: 8da4b37bc6b6e88803a478844b32aa6d04d28b95ab6a147caea69a22e1ce512a70e0df9e6196ceb0cbc87a5c1a164f01d927adcb054d36d2aa98e56ecac854c9
7
- data.tar.gz: f0a3f79d9ba42b596f27861ed9b046d82fd3805b47d62c7745b4bac7e69033904a6bbd90ea9d137370679e6e4ea8a42672cd31378f28b8a6b5d52141837c4d86
6
+ metadata.gz: 9e6930e8069732e7988b731d826a9e82b023c8f4bbebd5827a31efa10747ada86af64e7e75553df5a8d2e318688002e9c194cdf07e9124ef4231986197d885e7
7
+ data.tar.gz: fe46acbfd31436293ead08b37258c877ca4eddf3bb6c41e462a74c89153d4f632e244c2fa5b98b0887fbfe024a3ab8a9ada8ad101fffb9bebfd10dbbd9f5c9bc
data/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  ## master (unreleased)
2
2
 
3
+ ## 0.31.2 (2025-11-13)
4
+
5
+ - Fix running background data migrations inline
6
+
7
+ ## 0.31.1 (2025-11-11)
8
+
9
+ - Do not attempt running background migrations on database with `database_tasks: false`
10
+
3
11
  ## 0.31.0 (2025-10-22)
4
12
 
5
13
  - Store backtraces for failed background data migrations jobs
@@ -37,7 +37,16 @@ module OnlineMigrations
37
37
  # TODO: use 'cursor' accessor from sidekiq in the future.
38
38
  # https://github.com/sidekiq/sidekiq/pull/6606
39
39
  @migration.persist_progress(@_cursor, ticks, duration)
40
- @migration.reload
40
+
41
+ # When using a scheduler, these are running only from a single shard, but when inline -
42
+ # these are run from each shard (not needed, but simplifies the implementation).
43
+ #
44
+ # Do not reload the migration when running inline, because it can be from a different shard
45
+ # than the "default" shard (which is used to lookup background migrations).
46
+ if !Utils.run_background_migrations_inline?
47
+ # Reload to check if the migration's status changed etc.
48
+ @migration.reload
49
+ end
41
50
  end
42
51
 
43
52
  @throttle_checked_at = current_time
@@ -127,7 +127,14 @@ module OnlineMigrations
127
127
  # This is the way that currently is used in ActiveRecord tests themselves.
128
128
  pool_manager = ActiveRecord::Base.connection_handler.send(:get_pool_manager, ancestor.name)
129
129
 
130
- return pool_manager.shard_names if pool_manager
130
+ if pool_manager
131
+ shards_with_database_tasks = pool_manager.shard_names.select do |shard_name|
132
+ pool_config = pool_manager.get_pool_config(:writing, shard_name)
133
+ pool_config.db_config.database_tasks? if pool_config
134
+ end
135
+
136
+ return shards_with_database_tasks
137
+ end
131
138
  end
132
139
  end
133
140
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module OnlineMigrations
4
- VERSION = "0.31.0"
4
+ VERSION = "0.31.2"
5
5
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: online_migrations
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.31.0
4
+ version: 0.31.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - fatkodima
8
8
  bindir: bin
9
9
  cert_chain: []
10
- date: 2025-10-22 00:00:00.000000000 Z
10
+ date: 2025-11-12 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: activerecord