wurk 1.7.2 → 1.7.3

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: d535340ce300b6e688dbeed5657583ebd3c5795363b9737482a801b666bb8643
4
- data.tar.gz: 805d1e4aa47fb526d3c6660c160a6c87a9de399070518a545d8d2f12a321920e
3
+ metadata.gz: de5a24063d924950bf14f06ba530215018d35acc33a069a9a6698f48602833fa
4
+ data.tar.gz: bcdf163c1de721563e707958f3487e2518f175a811143f84e48b070b55e4cacb
5
5
  SHA512:
6
- metadata.gz: 551f19e3fc8f8008724d92d2851d4856af46b9fd7a7089f72d250439f03ff48107e5a5f327b0f279e728a8d9011bf70237a26b5f6355a7ddbc72549e745471d4
7
- data.tar.gz: 72d3b2cd7123cf96219ff797217588bf366975c4eac07bfdb339c8f840d11d52bb32c1c1a024de345e895b6d2b2a8c768d815780c74d2f9c0696f1d5e133730a
6
+ metadata.gz: cc074e442e5987d123b86d9e02c8349840cd7c0b5e90d0cc5866b8e928f136e8d8ac5c861ffcf1c8a9243c0bb5e053f79a9b9477654d28b7728aadf7129957f3
7
+ data.tar.gz: 8c1ee815585ca13aef64a68d62b98e50288aeb989a98471177b4ddc94dfa8baddd33a74b42ff75eb92133b54e2da1c7f8ddbcb3403182ccda55112df33e2c6bd
data/lib/wurk/cli.rb CHANGED
@@ -240,7 +240,11 @@ module Wurk
240
240
 
241
241
  # --- run helpers ----------------------------------------------------
242
242
 
243
+ # Claim the worker boot before the host app loads, so the railtie's
244
+ # after_initialize hook knows this process already has a worker and does
245
+ # not fork a second one on top of it (#worker_boot_claimed?).
243
246
  def enter_server_mode
247
+ Wurk.claim_worker_boot!
244
248
  Wurk.enter_server_mode(@config)
245
249
  end
246
250
 
@@ -42,8 +42,14 @@ module Wurk
42
42
  # A process that won't run workers isn't a server: skip both server mode
43
43
  # and the swarm boot. Console mode is detected reliably here — the console
44
44
  # command file defines ::Rails::Console before initializers run.
45
+ #
46
+ # `Wurk.worker_boot_claimed?` covers the CLI: `bundle exec wurk` boots the
47
+ # host app itself and then runs a Launcher in this very process, so forking
48
+ # a swarm here as well would put two independent workers on one queue and
49
+ # run every job — every cron tick included — twice.
45
50
  def skip_boot?
46
51
  ENV['WURK_DISABLED'] == '1' ||
52
+ Wurk.worker_boot_claimed? ||
47
53
  building? ||
48
54
  defined?(::Rails::Console) ||
49
55
  ::Rails.env.test?
data/lib/wurk/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Wurk
4
- VERSION = '1.7.2'
4
+ VERSION = '1.7.3'
5
5
  end
data/lib/wurk.rb CHANGED
@@ -225,6 +225,31 @@ module Wurk
225
225
  config[:server] = true
226
226
  end
227
227
 
228
+ # True once something in THIS process has taken responsibility for running
229
+ # the workers. The CLI claims it before it boots the host application; the
230
+ # railtie's `after_initialize` hook reads it and stands down.
231
+ #
232
+ # Without the claim, `bundle exec wurk` inside a Rails app runs two
233
+ # independent workers: the CLI boots the app, the railtie forks a swarm
234
+ # from after_initialize, and then the CLI starts its own Launcher in the
235
+ # parent. Both drain the same queue, so every job runs twice — including
236
+ # every cron tick. See #claim_worker_boot!.
237
+ def worker_boot_claimed?
238
+ !!@worker_boot_claimed
239
+ end
240
+
241
+ # Claimed by the wurk/wurkswarm CLI. Not part of `enter_server_mode`: the
242
+ # railtie enters server mode too, and claiming there would make the railtie
243
+ # skip its own boot and run no workers at all.
244
+ def claim_worker_boot!
245
+ @worker_boot_claimed = true
246
+ end
247
+
248
+ # Test seam, matching `attr_writer :server` above: the claim is
249
+ # process-global, so a test that runs the CLI has to hand it back or it
250
+ # leaks into whatever test class shares the worker process next.
251
+ attr_writer :worker_boot_claimed
252
+
228
253
  # Wurk ships Pro+Ent features in the free gem; these flags exist solely
229
254
  # for third-party gems that branch on Sidekiq.pro? / Sidekiq.ent?.
230
255
  def pro?
@@ -1,4 +1,4 @@
1
1
  {
2
- "version": "1.7.2",
3
- "timestamp": "2026-08-11T12:40:51.498Z"
2
+ "version": "1.7.3",
3
+ "timestamp": "2026-08-18T15:19:58.150Z"
4
4
  }
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wurk
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.7.2
4
+ version: 1.7.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - developerz.ai