wurk 1.0.0 → 1.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: 774727bf58b55972fbc4ace533c90803233ad6e4a42d6e8b8cec0f464972bae3
4
- data.tar.gz: e06ddec0e9138bb50be07a50184d46b500affe8f9212d5aaa290be75b35a73da
3
+ metadata.gz: dc76b5c62f729370d36c966fdbd391aa77bc0cdd9edfc64148024351a52e3191
4
+ data.tar.gz: 7293ddf887066f715c5263ea9eceb92b5c05bc5a8324651fa857cc4b2486f215
5
5
  SHA512:
6
- metadata.gz: e0f7924f14f94fc5f4143be95389f461c988d2772cb05d4502a77d9959431420d4392a5dc7d9d390038fa372da0b492b4f0d095bb566d6abc0fc4a6bf3fa5605
7
- data.tar.gz: 8cc09f2445d8e75f40cdc06ac84597748de5e2a7cbfd99ec9ad062e88ca5df03f7be7e117c221533c796304a6b90e6e47555f26d307a04a44b550b570449ceeb
6
+ metadata.gz: 0c571b8c549c76c48f12aa7bdc5d249cbcd1fed5f17f08ad96a4621d836e02c9bd587b0d0d22c9e713fa90778a1e48c065063d5d3deb6ca9e109e5bee606430a
7
+ data.tar.gz: 6c0056e1f4b18f4d63ecb5a5b790fdf2d81ea1cc2a650af8fde6c901181bf858cf602c21b689cd363869cd0301e9981eb3707f2f8a69335f1b9ba7dfa995a355
data/lib/wurk/cron.rb CHANGED
@@ -574,6 +574,9 @@ module Wurk
574
574
  end
575
575
 
576
576
  def enqueue!(loop_obj)
577
+ aj = active_job_class(loop_obj.klass)
578
+ return enqueue_active_job(aj, loop_obj) if aj
579
+
577
580
  @client.push(
578
581
  'class' => loop_obj.klass,
579
582
  'args' => loop_obj.args,
@@ -582,6 +585,32 @@ module Wurk
582
585
  )
583
586
  end
584
587
 
588
+ # Resolve a loop's class name to an ActiveJob::Base subclass, or nil when
589
+ # ActiveJob isn't loaded (standalone wurk) or the class isn't one.
590
+ # sidekiq-cron parity: a cron loop targeting an ActiveJob must enqueue
591
+ # through the AJ adapter so the job runs via Sidekiq::ActiveJob::Wrapper
592
+ # with full callbacks/serialization — a bare `client.push('class' => …)`
593
+ # would make the processor call `Klass.new.perform`, skipping all of AJ.
594
+ def active_job_class(name)
595
+ return nil unless defined?(::ActiveJob::Base)
596
+
597
+ const = name.split('::').inject(::Object) { |mod, c| mod.const_get(c) }
598
+ const if const.is_a?(::Class) && const < ::ActiveJob::Base
599
+ rescue ::NameError
600
+ nil
601
+ end
602
+
603
+ # Enqueue via the AJ adapter (→ wurk). Only override the queue when the
604
+ # loop set one explicitly; otherwise the job's own `queue_as` wins. AJ's
605
+ # `retry_on`/`discard_on` govern retries, so the Sidekiq `retry` option
606
+ # doesn't apply here. Returns the wurk jid (provider_job_id) so the fire
607
+ # history records it; nil if a before_enqueue callback halted the push.
608
+ def enqueue_active_job(klass, loop_obj)
609
+ target = loop_obj.queue == 'default' ? klass : klass.set(queue: loop_obj.queue)
610
+ job = target.perform_later(*loop_obj.args)
611
+ job.provider_job_id if job.respond_to?(:provider_job_id)
612
+ end
613
+
585
614
  def read_fire_marks(lid)
586
615
  @config.redis do |c|
587
616
  vals = c.call('HMGET', "#{LOOP_PREFIX}#{lid}", 'lf', 'nf')
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.0.0"
4
+ VERSION = "1.0.1"
5
5
  end
@@ -1,4 +1,4 @@
1
1
  {
2
- "version": "1.0.0",
3
- "timestamp": "2026-06-11T23:14:25.445Z"
2
+ "version": "1.0.1",
3
+ "timestamp": "2026-06-11T23:38:17.197Z"
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.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - developerz.ai