activejob 7.0.8.4 → 7.1.3.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (42) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +160 -143
  3. data/MIT-LICENSE +1 -1
  4. data/README.md +2 -2
  5. data/lib/active_job/arguments.rb +28 -31
  6. data/lib/active_job/base.rb +1 -1
  7. data/lib/active_job/callbacks.rb +3 -5
  8. data/lib/active_job/configured_job.rb +4 -0
  9. data/lib/active_job/core.rb +26 -6
  10. data/lib/active_job/deprecator.rb +7 -0
  11. data/lib/active_job/enqueuing.rb +31 -1
  12. data/lib/active_job/exceptions.rb +48 -5
  13. data/lib/active_job/execution.rb +5 -1
  14. data/lib/active_job/gem_version.rb +3 -3
  15. data/lib/active_job/instrumentation.rb +18 -10
  16. data/lib/active_job/log_subscriber.rb +80 -8
  17. data/lib/active_job/queue_adapter.rb +13 -2
  18. data/lib/active_job/queue_adapters/async_adapter.rb +2 -2
  19. data/lib/active_job/queue_adapters/backburner_adapter.rb +7 -3
  20. data/lib/active_job/queue_adapters/delayed_job_adapter.rb +1 -1
  21. data/lib/active_job/queue_adapters/inline_adapter.rb +1 -1
  22. data/lib/active_job/queue_adapters/queue_classic_adapter.rb +4 -4
  23. data/lib/active_job/queue_adapters/resque_adapter.rb +1 -1
  24. data/lib/active_job/queue_adapters/sidekiq_adapter.rb +42 -14
  25. data/lib/active_job/queue_adapters/sneakers_adapter.rb +1 -1
  26. data/lib/active_job/queue_adapters/sucker_punch_adapter.rb +3 -3
  27. data/lib/active_job/queue_adapters/test_adapter.rb +3 -3
  28. data/lib/active_job/queue_adapters.rb +8 -7
  29. data/lib/active_job/queue_priority.rb +18 -1
  30. data/lib/active_job/railtie.rb +25 -6
  31. data/lib/active_job/serializers/big_decimal_serializer.rb +22 -0
  32. data/lib/active_job/serializers/duration_serializer.rb +4 -2
  33. data/lib/active_job/serializers/time_with_zone_serializer.rb +11 -2
  34. data/lib/active_job/serializers.rb +7 -3
  35. data/lib/active_job/test_helper.rb +32 -14
  36. data/lib/active_job/version.rb +1 -1
  37. data/lib/active_job.rb +26 -4
  38. data/lib/rails/generators/job/USAGE +19 -0
  39. data/lib/rails/generators/job/job_generator.rb +6 -2
  40. data/lib/rails/generators/job/templates/job.rb.tt +1 -1
  41. metadata +9 -7
  42. data/lib/active_job/queue_adapters/que_adapter.rb +0 -61
@@ -1,61 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "que"
4
-
5
- module ActiveJob
6
- module QueueAdapters
7
- # == Que adapter for Active Job
8
- #
9
- # Que is a high-performance alternative to DelayedJob or QueueClassic that
10
- # improves the reliability of your application by protecting your jobs with
11
- # the same ACID guarantees as the rest of your data. Que is a queue for
12
- # Ruby and PostgreSQL that manages jobs using advisory locks.
13
- #
14
- # Read more about Que {here}[https://github.com/chanks/que].
15
- #
16
- # To use Que set the queue_adapter config to +:que+.
17
- #
18
- # Rails.application.config.active_job.queue_adapter = :que
19
- class QueAdapter
20
- def enqueue(job) # :nodoc:
21
- job_options = { priority: job.priority, queue: job.queue_name }
22
- que_job = nil
23
-
24
- if require_job_options_kwarg?
25
- que_job = JobWrapper.enqueue job.serialize, job_options: job_options
26
- else
27
- que_job = JobWrapper.enqueue job.serialize, **job_options
28
- end
29
-
30
- job.provider_job_id = que_job.attrs["job_id"]
31
- que_job
32
- end
33
-
34
- def enqueue_at(job, timestamp) # :nodoc:
35
- job_options = { priority: job.priority, queue: job.queue_name, run_at: Time.at(timestamp) }
36
- que_job = nil
37
-
38
- if require_job_options_kwarg?
39
- que_job = JobWrapper.enqueue job.serialize, job_options: job_options
40
- else
41
- que_job = JobWrapper.enqueue job.serialize, **job_options
42
- end
43
-
44
- job.provider_job_id = que_job.attrs["job_id"]
45
- que_job
46
- end
47
-
48
- private
49
- def require_job_options_kwarg?
50
- @require_job_options_kwarg ||=
51
- JobWrapper.method(:enqueue).parameters.any? { |ptype, pname| ptype == :key && pname == :job_options }
52
- end
53
-
54
- class JobWrapper < Que::Job # :nodoc:
55
- def run(job_data)
56
- Base.execute job_data
57
- end
58
- end
59
- end
60
- end
61
- end