mission_control-jobs 0.2.2 → 0.3.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: '0516069c5660225d8cc418be4c2898ae247004ff150e9bf491b74fa7b1111a79'
4
- data.tar.gz: 16b68f33818169e31b3701d84e3e53d8b5069e07c4b5e84303c0917212bc45fc
3
+ metadata.gz: 2296e3b78c4cd2ca39de903ff7eaf2b198147b596fdc615143b3a58ea7d0e940
4
+ data.tar.gz: 7a3289d51f83098ef40a2ae8768b838f3d695617ea312a9704627a37d4159ae8
5
5
  SHA512:
6
- metadata.gz: 9290598911e316cb5e70f6cb23757704b1966c291d4e928fc3f94f0c50b03191d00fb8a8170ee0b154a36235c43b16b686b05b0629467d3575807e28ef57331c
7
- data.tar.gz: 2136cc09bcaa59e3a8dbfd6d19984bcb2d82d1b44c8870cf7019330af08b0b26a112079013eaa5df86e705efc50161851b0cc6094a173e778e672961426ac0e6
6
+ metadata.gz: 198595c5e3d82916c17d175ee542412e1cfe7dd718394f1f1878049dbaf0dc718b84ba6c01ee74e716060747ff3e947175170b43c69884299d1c1a114d26e2ec
7
+ data.tar.gz: 3f4fecc8444f2f8aea8d6aa5cd91361b2daf128e59e6a5d4fe0a41f2bb8b46fe3aed12cbf2fbc8254e7c0c39a768db6bc4aef81a45b35c43e1b0a61a38c3c980
data/README.md CHANGED
@@ -65,6 +65,7 @@ This library extends Active Job with a querying interface and the following sett
65
65
  ## Adapter Specifics
66
66
 
67
67
  - **Resque**: Queue pausing is supported only if you have `resque-pause` installed in your project
68
+ - **Solid Queue**: Requires version >= 0.5.
68
69
 
69
70
  ## Advanced configuration
70
71
 
@@ -3,6 +3,6 @@ module MissionControl::Jobs
3
3
  # Explicit helper inclusion because ApplicationController inherits from the host app.
4
4
  #
5
5
  # We can't rely on +config.action_controller.include_all_helpers = true+ in the host app.
6
- include DatesHelper, JobsHelper, NavigationHelper, UiHelper
6
+ include DatesHelper, JobsHelper, NavigationHelper, InterfaceHelper
7
7
  end
8
8
  end
@@ -1,4 +1,4 @@
1
- module MissionControl::Jobs::UiHelper
1
+ module MissionControl::Jobs::InterfaceHelper
2
2
  def blank_status_notice(message)
3
3
  tag.div message, class: "mt-6 has-text-centered is-size-3 has-text-grey"
4
4
  end
@@ -4,36 +4,29 @@ module ActiveJob::QueueAdapters::SolidQueueExt::RecurringTasks
4
4
  end
5
5
 
6
6
  def recurring_tasks
7
- tasks = recurring_tasks_from_dispatchers
8
- last_enqueued_at_times = recurring_task_last_enqueued_at(tasks.keys)
7
+ tasks = SolidQueue::RecurringTask.all
8
+ last_enqueued_at_times = recurring_task_last_enqueued_at(tasks.map(&:key))
9
9
 
10
- recurring_tasks_from_dispatchers.collect do |task_id, task_attrs|
11
- recurring_task_attributes_from_solid_queue_task_attributes(task_attrs).merge \
12
- id: task_id,
13
- last_enqueued_at: last_enqueued_at_times[task_id]
10
+ tasks.collect do |task|
11
+ recurring_task_attributes_from_solid_queue_recurring_task(task).merge \
12
+ last_enqueued_at: last_enqueued_at_times[task.key]
14
13
  end
15
14
  end
16
15
 
17
16
  def find_recurring_task(task_id)
18
- if task_attrs = recurring_tasks_from_dispatchers[task_id]
19
- recurring_task_attributes_from_solid_queue_task_attributes(task_attrs).merge \
20
- id: task_id,
21
- last_enqueued_at: recurring_task_last_enqueued_at(task_id).values&.first
17
+ if task = SolidQueue::RecurringTask.find_by(key: task_id)
18
+ recurring_task_attributes_from_solid_queue_recurring_task(task).merge \
19
+ last_enqueued_at: recurring_task_last_enqueued_at(task.key).values&.first
22
20
  end
23
21
  end
24
22
 
25
23
  private
26
- def recurring_tasks_from_dispatchers
27
- SolidQueue::Process.where(kind: "Dispatcher").flat_map do |process|
28
- process.metadata["recurring_schedule"]
29
- end.compact.reduce({}, &:merge)
30
- end
31
-
32
- def recurring_task_attributes_from_solid_queue_task_attributes(task_attributes)
24
+ def recurring_task_attributes_from_solid_queue_recurring_task(task)
33
25
  {
34
- job_class_name: task_attributes["class_name"],
35
- arguments: task_attributes["arguments"],
36
- schedule: task_attributes["schedule"]
26
+ id: task.key,
27
+ job_class_name: task.class_name,
28
+ arguments: task.arguments,
29
+ schedule: task.schedule
37
30
  }
38
31
  end
39
32
 
@@ -118,7 +118,7 @@ module ActiveJob::QueueAdapters::SolidQueueExt
118
118
  ActiveJob::ExecutionError.new \
119
119
  error_class: solid_queue_job.failed_execution.exception_class,
120
120
  message: solid_queue_job.failed_execution.message,
121
- backtrace: solid_queue_job.failed_execution.backtrace
121
+ backtrace: solid_queue_job.failed_execution.backtrace || []
122
122
  end
123
123
  end
124
124
 
@@ -1,5 +1,5 @@
1
1
  module MissionControl
2
2
  module Jobs
3
- VERSION = "0.2.2"
3
+ VERSION = "0.3.1"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mission_control-jobs
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jorge Manrubia
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-08-06 00:00:00.000000000 Z
11
+ date: 2024-08-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -100,14 +100,14 @@ dependencies:
100
100
  requirements:
101
101
  - - ">="
102
102
  - !ruby/object:Gem::Version
103
- version: '0'
103
+ version: '0.5'
104
104
  type: :development
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
108
  - - ">="
109
109
  - !ruby/object:Gem::Version
110
- version: '0'
110
+ version: '0.5'
111
111
  - !ruby/object:Gem::Dependency
112
112
  name: selenium-webdriver
113
113
  requirement: !ruby/object:Gem::Requirement
@@ -310,9 +310,9 @@ files:
310
310
  - app/controllers/mission_control/jobs/workers_controller.rb
311
311
  - app/helpers/mission_control/jobs/application_helper.rb
312
312
  - app/helpers/mission_control/jobs/dates_helper.rb
313
+ - app/helpers/mission_control/jobs/interface_helper.rb
313
314
  - app/helpers/mission_control/jobs/jobs_helper.rb
314
315
  - app/helpers/mission_control/jobs/navigation_helper.rb
315
- - app/helpers/mission_control/jobs/ui_helper.rb
316
316
  - app/javascript/mission_control/jobs/application.js
317
317
  - app/javascript/mission_control/jobs/controllers/application.js
318
318
  - app/javascript/mission_control/jobs/controllers/form_controller.js