solid_queue 1.3.0 → 1.3.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 +4 -4
- data/README.md +2 -0
- data/app/models/solid_queue/failed_execution.rb +1 -1
- data/app/models/solid_queue/job/concurrency_controls.rb +1 -1
- data/app/models/solid_queue/job/retryable.rb +10 -1
- data/app/models/solid_queue/recurring_task.rb +15 -6
- data/app/models/solid_queue/semaphore.rb +1 -1
- data/lib/puma/plugin/solid_queue.rb +3 -1
- data/lib/solid_queue/async_supervisor.rb +8 -6
- data/lib/solid_queue/cli.rb +1 -1
- data/lib/solid_queue/fork_supervisor.rb +1 -1
- data/lib/solid_queue/processes/registrable.rb +1 -1
- data/lib/solid_queue/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: fb6ce5453b198c213a9de3fd6214ad410e158f1941a024fff5256f5895532523
|
|
4
|
+
data.tar.gz: 8d9172270e0cbabbfde5c5084c4da52d615a787921acb1c837bccd494556d977
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 3c9155032132f14e03132e651846fa4b2bec944f96eb62d988dc75a82abfcb5f4e3a1fde9f4bb4591866d8cb230bd188df4cb9f028b6adcdf09f161d9a48f2e0
|
|
7
|
+
data.tar.gz: 0aecdd6b91de9f6026b9ea041a673709e348ddaac093ad6ebb57b5bdd98cd6b4f255e8e9350d790a8635703d0249407871f2c6258594593871c56b690fc8f3e7
|
data/README.md
CHANGED
|
@@ -258,6 +258,8 @@ Here's an overview of the different options:
|
|
|
258
258
|
```
|
|
259
259
|
|
|
260
260
|
This will create a worker fetching jobs from all queues starting with `staging`. The wildcard `*` is only allowed on its own or at the end of a queue name; you can't specify queue names such as `*_some_queue`. These will be ignored.
|
|
261
|
+
|
|
262
|
+
Also, if a wildcard (*) is included alongside explicit queue names, for example: `queues: [default, backend, *]`, then it would behave like `queues: *`
|
|
261
263
|
|
|
262
264
|
Finally, you can combine prefixes with exact names, like `[ staging*, background ]`, and the behaviour with respect to order will be the same as with only exact names.
|
|
263
265
|
|
|
@@ -16,7 +16,16 @@ module SolidQueue
|
|
|
16
16
|
end
|
|
17
17
|
|
|
18
18
|
def failed_with(exception)
|
|
19
|
-
FailedExecution.
|
|
19
|
+
FailedExecution.transaction(requires_new: true) do
|
|
20
|
+
FailedExecution.create!(job_id: id, exception: exception)
|
|
21
|
+
end
|
|
22
|
+
rescue ActiveRecord::RecordNotUnique
|
|
23
|
+
if (failed_execution = FailedExecution.find_by(job_id: id))
|
|
24
|
+
failed_execution.exception = exception
|
|
25
|
+
failed_execution.save!
|
|
26
|
+
else
|
|
27
|
+
retry
|
|
28
|
+
end
|
|
20
29
|
end
|
|
21
30
|
|
|
22
31
|
def reset_execution_counters
|
|
@@ -6,9 +6,9 @@ module SolidQueue
|
|
|
6
6
|
class RecurringTask < Record
|
|
7
7
|
serialize :arguments, coder: Arguments, default: []
|
|
8
8
|
|
|
9
|
-
validate :
|
|
9
|
+
validate :ensure_schedule_supported
|
|
10
10
|
validate :ensure_command_or_class_present
|
|
11
|
-
validate :
|
|
11
|
+
validate :ensure_existing_job_class
|
|
12
12
|
|
|
13
13
|
scope :static, -> { where(static: true) }
|
|
14
14
|
|
|
@@ -102,19 +102,28 @@ module SolidQueue
|
|
|
102
102
|
end
|
|
103
103
|
|
|
104
104
|
private
|
|
105
|
-
def
|
|
105
|
+
def ensure_schedule_supported
|
|
106
106
|
unless parsed_schedule.instance_of?(Fugit::Cron)
|
|
107
107
|
errors.add :schedule, :unsupported, message: "is not a supported recurring schedule"
|
|
108
108
|
end
|
|
109
|
+
rescue ArgumentError => error
|
|
110
|
+
message = if error.message.include?("multiple crons")
|
|
111
|
+
"generates multiple cron schedules. Please use separate recurring tasks for each schedule, " +
|
|
112
|
+
"or use explicit cron syntax (e.g., '40 0,15 * * *' for multiple times with the same minutes)"
|
|
113
|
+
else
|
|
114
|
+
error.message
|
|
115
|
+
end
|
|
116
|
+
|
|
117
|
+
errors.add :schedule, :unsupported, message: message
|
|
109
118
|
end
|
|
110
119
|
|
|
111
120
|
def ensure_command_or_class_present
|
|
112
121
|
unless command.present? || class_name.present?
|
|
113
|
-
errors.add :base, :command_and_class_blank, message: "either command or
|
|
122
|
+
errors.add :base, :command_and_class_blank, message: "either command or class must be present"
|
|
114
123
|
end
|
|
115
124
|
end
|
|
116
125
|
|
|
117
|
-
def
|
|
126
|
+
def ensure_existing_job_class
|
|
118
127
|
if class_name.present? && job_class.nil?
|
|
119
128
|
errors.add :class_name, :undefined, message: "doesn't correspond to an existing class"
|
|
120
129
|
end
|
|
@@ -152,7 +161,7 @@ module SolidQueue
|
|
|
152
161
|
|
|
153
162
|
|
|
154
163
|
def parsed_schedule
|
|
155
|
-
@parsed_schedule ||= Fugit.parse(schedule)
|
|
164
|
+
@parsed_schedule ||= Fugit.parse(schedule, multi: :fail)
|
|
156
165
|
end
|
|
157
166
|
|
|
158
167
|
def job_class
|
|
@@ -82,9 +82,11 @@ Puma::Plugin.create do
|
|
|
82
82
|
end
|
|
83
83
|
|
|
84
84
|
def stop_solid_queue_fork
|
|
85
|
+
return unless solid_queue_pid
|
|
86
|
+
|
|
85
87
|
Process.waitpid(solid_queue_pid, Process::WNOHANG)
|
|
86
88
|
log "Stopping Solid Queue..."
|
|
87
|
-
Process.kill(:INT, solid_queue_pid)
|
|
89
|
+
Process.kill(:INT, solid_queue_pid)
|
|
88
90
|
Process.wait(solid_queue_pid)
|
|
89
91
|
rescue Errno::ECHILD, Errno::ESRCH
|
|
90
92
|
end
|
|
@@ -19,17 +19,19 @@ module SolidQueue
|
|
|
19
19
|
|
|
20
20
|
def check_and_replace_terminated_processes
|
|
21
21
|
terminated_threads = process_instances.select { |thread_id, instance| !instance.alive? }
|
|
22
|
-
terminated_threads.each { |thread_id,
|
|
22
|
+
terminated_threads.each { |thread_id, _| replace_thread(thread_id) }
|
|
23
23
|
end
|
|
24
24
|
|
|
25
|
-
def replace_thread(thread_id
|
|
25
|
+
def replace_thread(thread_id)
|
|
26
26
|
SolidQueue.instrument(:replace_thread, supervisor_pid: ::Process.pid) do |payload|
|
|
27
|
-
|
|
27
|
+
if (instance = process_instances.delete(thread_id))
|
|
28
|
+
payload[:thread] = instance
|
|
28
29
|
|
|
29
|
-
|
|
30
|
-
|
|
30
|
+
error = Processes::ThreadTerminatedError.new(instance.name)
|
|
31
|
+
release_claimed_jobs_by(instance, with_error: error)
|
|
31
32
|
|
|
32
|
-
|
|
33
|
+
start_process(configured_processes.delete(thread_id))
|
|
34
|
+
end
|
|
33
35
|
end
|
|
34
36
|
end
|
|
35
37
|
|
data/lib/solid_queue/cli.rb
CHANGED
|
@@ -8,7 +8,7 @@ module SolidQueue
|
|
|
8
8
|
desc: "Path to config file (default: #{Configuration::DEFAULT_CONFIG_FILE_PATH}).",
|
|
9
9
|
banner: "SOLID_QUEUE_CONFIG"
|
|
10
10
|
|
|
11
|
-
class_option :mode, type: :string,
|
|
11
|
+
class_option :mode, type: :string, enum: %w[ fork async ],
|
|
12
12
|
desc: "Whether to fork processes for workers and dispatchers (fork) or to run these in the same process as the supervisor (async) (default: fork).",
|
|
13
13
|
banner: "SOLID_QUEUE_SUPERVISOR_MODE"
|
|
14
14
|
|
|
@@ -38,7 +38,7 @@ module SolidQueue
|
|
|
38
38
|
pid, status = ::Process.waitpid2(-1, ::Process::WNOHANG)
|
|
39
39
|
break unless pid
|
|
40
40
|
|
|
41
|
-
if (terminated_fork = process_instances.delete(pid)) && !status.exited? || status.exitstatus > 0
|
|
41
|
+
if (terminated_fork = process_instances.delete(pid)) && (!status.exited? || status.exitstatus.to_i > 0)
|
|
42
42
|
error = Processes::ProcessExitError.new(status)
|
|
43
43
|
release_claimed_jobs_by(terminated_fork, with_error: error)
|
|
44
44
|
end
|
data/lib/solid_queue/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: solid_queue
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.3.
|
|
4
|
+
version: 1.3.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Rosa Gutierrez
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-
|
|
11
|
+
date: 2026-02-20 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: activerecord
|