solid_queue_monitor 2.4.0 → 2.5.0
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 +9 -0
- data/app/controllers/solid_queue_monitor/application_controller.rb +8 -0
- data/app/controllers/solid_queue_monitor/base_controller.rb +14 -15
- data/app/controllers/solid_queue_monitor/failed_jobs_controller.rb +2 -2
- data/app/controllers/solid_queue_monitor/in_progress_jobs_controller.rb +1 -3
- data/app/controllers/solid_queue_monitor/queues_controller.rb +2 -2
- data/app/controllers/solid_queue_monitor/scheduled_jobs_controller.rb +1 -1
- data/app/services/solid_queue_monitor/chart_data_service.rb +22 -3
- data/app/services/solid_queue_monitor/failed_job_service.rb +10 -23
- data/app/services/solid_queue_monitor/search_service.rb +27 -54
- data/app/services/solid_queue_monitor/stats_calculator.rb +5 -1
- data/app/views/solid_queue_monitor/overview/_stats.html.erb +1 -0
- data/lib/solid_queue_monitor/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: d7964ff75c4d4e7a81898439c2e9fc1c3978e8dbef19be614edf6c7f6b2547ab
|
|
4
|
+
data.tar.gz: f33df02ee0f21336015bce42d09427e711e02bdd204e2e5b48207eac9fc71da8
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 7c40ef1174f29d695c252491ac80bb6be7fb7acfbc76d00940a852ef13db0d6e19872aa13a861cec83acb013eceb6777bc31f663a7c46d3d3148e7919127433c
|
|
7
|
+
data.tar.gz: 425df8929863f98bebf08a673cff0e4689cc50e53d095cd537c94939add8d073c10befec799d1f3146882b69739e4005e8af67a6bc82be3222323dc54ca3fee8
|
data/README.md
CHANGED
|
@@ -327,6 +327,15 @@ Please make sure to update tests as appropriate and follow the existing code sty
|
|
|
327
327
|
|
|
328
328
|
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
|
329
329
|
|
|
330
|
+
The suite runs on in-memory SQLite by default. Because some queries differ between adapters, it can also run on MySQL or PostgreSQL, the way CI does. Install the matching optional Bundler group, create an empty database, and point `DATABASE_URL` at it:
|
|
331
|
+
|
|
332
|
+
```bash
|
|
333
|
+
bundle config set --local with mysql # or: postgresql
|
|
334
|
+
bundle install
|
|
335
|
+
DATABASE_URL=mysql2://root@127.0.0.1/solid_queue_monitor_test bundle exec rspec
|
|
336
|
+
DATABASE_URL=postgresql://postgres@127.0.0.1/solid_queue_monitor_test bundle exec rspec
|
|
337
|
+
```
|
|
338
|
+
|
|
330
339
|
## License
|
|
331
340
|
|
|
332
341
|
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
|
@@ -36,6 +36,14 @@ module SolidQueueMonitor
|
|
|
36
36
|
|
|
37
37
|
private
|
|
38
38
|
|
|
39
|
+
# Only follow redirect_to within the dashboard: url_from drops other hosts
|
|
40
|
+
# and anything Rails' open-redirect check would reject with a 500.
|
|
41
|
+
def redirect_to_return_path(fallback)
|
|
42
|
+
target = url_from(params[:redirect_to])
|
|
43
|
+
target = nil unless target&.start_with?("#{request.script_name}/")
|
|
44
|
+
redirect_to(target || fallback)
|
|
45
|
+
end
|
|
46
|
+
|
|
39
47
|
def authenticate
|
|
40
48
|
authenticate_or_request_with_http_basic do |username, password|
|
|
41
49
|
SolidQueueMonitor::AuthenticationService.authenticate(username, password)
|
|
@@ -77,8 +77,16 @@ module SolidQueueMonitor
|
|
|
77
77
|
end
|
|
78
78
|
|
|
79
79
|
def filter_by_arguments(relation)
|
|
80
|
-
|
|
81
|
-
|
|
80
|
+
relation.where(arguments_match(relation))
|
|
81
|
+
end
|
|
82
|
+
|
|
83
|
+
def arguments_match(relation = SolidQueue::Job)
|
|
84
|
+
pattern = "%#{ActiveRecord::Base.sanitize_sql_like(params[:arguments].to_s)}%"
|
|
85
|
+
relation.arel_table[:arguments].matches(Arel::Nodes.build_quoted(pattern), '\\')
|
|
86
|
+
end
|
|
87
|
+
|
|
88
|
+
def jobs_matching_arguments
|
|
89
|
+
SolidQueue::Job.where(arguments_match).select(:id)
|
|
82
90
|
end
|
|
83
91
|
|
|
84
92
|
def filter_ready_jobs(relation)
|
|
@@ -90,9 +98,7 @@ module SolidQueueMonitor
|
|
|
90
98
|
|
|
91
99
|
relation = relation.where('queue_name LIKE ?', "%#{params[:queue_name]}%") if params[:queue_name].present?
|
|
92
100
|
|
|
93
|
-
if params[:arguments].present?
|
|
94
|
-
relation = relation.where(job_id: SolidQueue::Job.where('arguments::text ILIKE ?', "%#{params[:arguments]}%").select(:id))
|
|
95
|
-
end
|
|
101
|
+
relation = relation.where(job_id: jobs_matching_arguments) if params[:arguments].present?
|
|
96
102
|
|
|
97
103
|
relation
|
|
98
104
|
end
|
|
@@ -106,9 +112,7 @@ module SolidQueueMonitor
|
|
|
106
112
|
|
|
107
113
|
relation = relation.where('queue_name LIKE ?', "%#{params[:queue_name]}%") if params[:queue_name].present?
|
|
108
114
|
|
|
109
|
-
if params[:arguments].present?
|
|
110
|
-
relation = relation.where(job_id: SolidQueue::Job.where('arguments::text ILIKE ?', "%#{params[:arguments]}%").select(:id))
|
|
111
|
-
end
|
|
115
|
+
relation = relation.where(job_id: jobs_matching_arguments) if params[:arguments].present?
|
|
112
116
|
|
|
113
117
|
relation
|
|
114
118
|
end
|
|
@@ -120,10 +124,7 @@ module SolidQueueMonitor
|
|
|
120
124
|
relation = relation.where('queue_name LIKE ?', "%#{params[:queue_name]}%") if params[:queue_name].present?
|
|
121
125
|
|
|
122
126
|
# Add arguments filtering if the model has arguments column
|
|
123
|
-
if params[:arguments].present? && relation.column_names.include?('arguments')
|
|
124
|
-
relation = relation.where('arguments::text ILIKE ?',
|
|
125
|
-
"%#{params[:arguments]}%")
|
|
126
|
-
end
|
|
127
|
+
relation = filter_by_arguments(relation) if params[:arguments].present? && relation.column_names.include?('arguments')
|
|
127
128
|
|
|
128
129
|
relation
|
|
129
130
|
end
|
|
@@ -143,9 +144,7 @@ module SolidQueueMonitor
|
|
|
143
144
|
end
|
|
144
145
|
end
|
|
145
146
|
|
|
146
|
-
if params[:arguments].present?
|
|
147
|
-
relation = relation.where(job_id: SolidQueue::Job.where('arguments::text ILIKE ?', "%#{params[:arguments]}%").select(:id))
|
|
148
|
-
end
|
|
147
|
+
relation = relation.where(job_id: jobs_matching_arguments) if params[:arguments].present?
|
|
149
148
|
|
|
150
149
|
relation
|
|
151
150
|
end
|
|
@@ -23,7 +23,7 @@ module SolidQueueMonitor
|
|
|
23
23
|
set_flash_message("Failed to retry job #{id}.", 'error')
|
|
24
24
|
end
|
|
25
25
|
|
|
26
|
-
|
|
26
|
+
redirect_to_return_path(failed_jobs_path)
|
|
27
27
|
end
|
|
28
28
|
|
|
29
29
|
def discard
|
|
@@ -36,7 +36,7 @@ module SolidQueueMonitor
|
|
|
36
36
|
set_flash_message("Failed to discard job #{id}.", 'error')
|
|
37
37
|
end
|
|
38
38
|
|
|
39
|
-
|
|
39
|
+
redirect_to_return_path(failed_jobs_path)
|
|
40
40
|
end
|
|
41
41
|
|
|
42
42
|
def retry_all
|
|
@@ -22,9 +22,7 @@ module SolidQueueMonitor
|
|
|
22
22
|
relation = relation.where(job_id: SolidQueue::Job.where('class_name LIKE ?', "%#{params[:class_name]}%").select(:id))
|
|
23
23
|
end
|
|
24
24
|
|
|
25
|
-
if params[:arguments].present?
|
|
26
|
-
relation = relation.where(job_id: SolidQueue::Job.where('arguments::text ILIKE ?', "%#{params[:arguments]}%").select(:id))
|
|
27
|
-
end
|
|
25
|
+
relation = relation.where(job_id: jobs_matching_arguments) if params[:arguments].present?
|
|
28
26
|
|
|
29
27
|
relation
|
|
30
28
|
end
|
|
@@ -35,7 +35,7 @@ module SolidQueueMonitor
|
|
|
35
35
|
result = QueuePauseService.new(queue_name).pause
|
|
36
36
|
|
|
37
37
|
set_flash_message(result[:message], result[:success] ? 'success' : 'error')
|
|
38
|
-
|
|
38
|
+
redirect_to_return_path(queues_path)
|
|
39
39
|
end
|
|
40
40
|
|
|
41
41
|
def resume
|
|
@@ -43,7 +43,7 @@ module SolidQueueMonitor
|
|
|
43
43
|
result = QueuePauseService.new(queue_name).resume
|
|
44
44
|
|
|
45
45
|
set_flash_message(result[:message], result[:success] ? 'success' : 'error')
|
|
46
|
-
|
|
46
|
+
redirect_to_return_path(queues_path)
|
|
47
47
|
end
|
|
48
48
|
|
|
49
49
|
private
|
|
@@ -26,7 +26,7 @@ module SolidQueueMonitor
|
|
|
26
26
|
def execute
|
|
27
27
|
SolidQueueMonitor::ExecuteJobService.new.call(params[:id])
|
|
28
28
|
set_flash_message('Job moved to ready queue', 'success')
|
|
29
|
-
|
|
29
|
+
redirect_to_return_path(scheduled_jobs_path)
|
|
30
30
|
rescue ActiveRecord::RecordNotFound
|
|
31
31
|
set_flash_message('Job not found', 'error')
|
|
32
32
|
redirect_to scheduled_jobs_path
|
|
@@ -60,7 +60,7 @@ module SolidQueueMonitor
|
|
|
60
60
|
# The bucket index is computed as: (epoch(column) - epoch(start_time)) / interval
|
|
61
61
|
# This works identically on PostgreSQL and SQLite.
|
|
62
62
|
def bucket_counts(model, column, start_time, end_time, interval, exclude_nil: false)
|
|
63
|
-
start_epoch = start_time
|
|
63
|
+
start_epoch = stored_epoch(start_time)
|
|
64
64
|
expr = bucket_index_expr(model, column, start_epoch, interval)
|
|
65
65
|
|
|
66
66
|
scope = model.where(column => start_time..end_time)
|
|
@@ -74,6 +74,19 @@ module SolidQueueMonitor
|
|
|
74
74
|
# rubocop:enable Style/HashTransformKeys
|
|
75
75
|
end
|
|
76
76
|
|
|
77
|
+
# The epoch of `time` in the frame the database computes for a stored
|
|
78
|
+
# timestamp. Every bucket expression below reads the zone-less stored
|
|
79
|
+
# value as if it were UTC. That is true when Rails stores UTC (the
|
|
80
|
+
# default). With `ActiveRecord.default_timezone = :local`, Rails stores the
|
|
81
|
+
# process's local wall time instead, so the start of the window is shifted
|
|
82
|
+
# by the same local offset to keep both sides in one frame.
|
|
83
|
+
def stored_epoch(time)
|
|
84
|
+
return time.to_i if ActiveRecord.default_timezone == :utc
|
|
85
|
+
|
|
86
|
+
epoch = time.to_i
|
|
87
|
+
epoch + Time.at(epoch).getlocal.utc_offset
|
|
88
|
+
end
|
|
89
|
+
|
|
77
90
|
def fill_buckets(buckets, index_counts)
|
|
78
91
|
buckets.map { |b| index_counts.fetch(b[:index], 0) }
|
|
79
92
|
end
|
|
@@ -81,7 +94,13 @@ module SolidQueueMonitor
|
|
|
81
94
|
# Cross-DB bucket index expression.
|
|
82
95
|
# PostgreSQL: CAST((EXTRACT(EPOCH FROM col) - start) / interval AS INTEGER)
|
|
83
96
|
# SQLite: CAST((CAST(strftime('%s', col) AS INTEGER) - start) / interval AS INTEGER)
|
|
84
|
-
# MySQL:
|
|
97
|
+
# MySQL: FLOOR((TIMESTAMPDIFF(SECOND, '1970-01-01', col) - start) / interval)
|
|
98
|
+
# (not UNIX_TIMESTAMP: it reads a DATETIME in the session time
|
|
99
|
+
# zone, which need not match the zone Rails stored it in — a
|
|
100
|
+
# mismatch shifts every bucket and drops rows out of the window)
|
|
101
|
+
#
|
|
102
|
+
# All three read the stored value as UTC wall time; `stored_epoch` puts
|
|
103
|
+
# `start` in the same frame.
|
|
85
104
|
#
|
|
86
105
|
# The adapter is detected from the model's own connection, not
|
|
87
106
|
# ActiveRecord::Base's. Solid Queue is commonly hosted on a dedicated
|
|
@@ -91,7 +110,7 @@ module SolidQueueMonitor
|
|
|
91
110
|
if adapter?(model, 'sqlite')
|
|
92
111
|
"CAST((CAST(strftime('%s', #{column}) AS INTEGER) - #{start_epoch}) / #{interval_seconds} AS INTEGER)"
|
|
93
112
|
elsif adapter?(model, 'mysql') || adapter?(model, 'trilogy')
|
|
94
|
-
"FLOOR((
|
|
113
|
+
"FLOOR((TIMESTAMPDIFF(SECOND, '1970-01-01 00:00:00', #{column}) - #{start_epoch}) / #{interval_seconds})"
|
|
95
114
|
else
|
|
96
115
|
"FLOOR((EXTRACT(EPOCH FROM #{column}) - #{start_epoch}) / #{interval_seconds})::integer"
|
|
97
116
|
end
|
|
@@ -5,21 +5,16 @@ module SolidQueueMonitor
|
|
|
5
5
|
def retry_job(failed_execution_id)
|
|
6
6
|
failed_execution = SolidQueue::FailedExecution.find_by(id: failed_execution_id)
|
|
7
7
|
return { success: false, message: 'Failed job not found' } unless failed_execution
|
|
8
|
+
return { success: false, message: 'Associated job not found' } unless failed_execution.job
|
|
8
9
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
SolidQueue::ReadyExecution.create!(
|
|
14
|
-
job_id: job.id,
|
|
15
|
-
queue_name: get_queue_name(failed_execution, job),
|
|
16
|
-
priority: job.priority
|
|
17
|
-
)
|
|
18
|
-
|
|
19
|
-
failed_execution.destroy!
|
|
20
|
-
end
|
|
10
|
+
# Solid Queue's retry runs in one transaction on its own database; doing it
|
|
11
|
+
# here with ActiveRecord::Base.transaction left orphaned jobs when the queue
|
|
12
|
+
# has a separate database.
|
|
13
|
+
failed_execution.retry
|
|
21
14
|
|
|
22
|
-
{ success: true, message: 'Job
|
|
15
|
+
{ success: true, message: 'Job queued for retry' }
|
|
16
|
+
rescue ActiveRecord::RecordNotFound
|
|
17
|
+
{ success: false, message: 'Failed job not found' }
|
|
23
18
|
end
|
|
24
19
|
|
|
25
20
|
def discard_job(failed_execution_id)
|
|
@@ -51,6 +46,8 @@ module SolidQueueMonitor
|
|
|
51
46
|
else
|
|
52
47
|
failed_count += 1
|
|
53
48
|
end
|
|
49
|
+
rescue StandardError
|
|
50
|
+
failed_count += 1
|
|
54
51
|
end
|
|
55
52
|
|
|
56
53
|
if success_count.positive? && failed_count.zero?
|
|
@@ -85,15 +82,5 @@ module SolidQueueMonitor
|
|
|
85
82
|
{ success: false, message: 'Failed to discard jobs' }
|
|
86
83
|
end
|
|
87
84
|
end
|
|
88
|
-
|
|
89
|
-
private
|
|
90
|
-
|
|
91
|
-
def get_queue_name(failed_execution, job)
|
|
92
|
-
if failed_execution.respond_to?(:queue_name) && failed_execution.queue_name.present?
|
|
93
|
-
failed_execution.queue_name
|
|
94
|
-
else
|
|
95
|
-
job.queue_name
|
|
96
|
-
end
|
|
97
|
-
end
|
|
98
85
|
end
|
|
99
86
|
end
|
|
@@ -11,15 +11,15 @@ module SolidQueueMonitor
|
|
|
11
11
|
def search
|
|
12
12
|
return empty_results if @query.blank?
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
pattern = Arel::Nodes.build_quoted("%#{ActiveRecord::Base.sanitize_sql_like(@query.to_s)}%")
|
|
15
15
|
|
|
16
16
|
{
|
|
17
|
-
ready: search_ready_jobs(
|
|
18
|
-
scheduled: search_scheduled_jobs(
|
|
19
|
-
failed: search_failed_jobs(
|
|
20
|
-
in_progress: search_in_progress_jobs(
|
|
21
|
-
completed: search_completed_jobs(
|
|
22
|
-
recurring: search_recurring_tasks(
|
|
17
|
+
ready: search_ready_jobs(pattern),
|
|
18
|
+
scheduled: search_scheduled_jobs(pattern),
|
|
19
|
+
failed: search_failed_jobs(pattern),
|
|
20
|
+
in_progress: search_in_progress_jobs(pattern),
|
|
21
|
+
completed: search_completed_jobs(pattern),
|
|
22
|
+
recurring: search_recurring_tasks(pattern)
|
|
23
23
|
}
|
|
24
24
|
end
|
|
25
25
|
|
|
@@ -36,91 +36,64 @@ module SolidQueueMonitor
|
|
|
36
36
|
}
|
|
37
37
|
end
|
|
38
38
|
|
|
39
|
-
def
|
|
40
|
-
# Escape % to prevent LIKE pattern injection
|
|
41
|
-
# We don't escape _ because it requires database-specific ESCAPE clauses
|
|
42
|
-
query.to_s.gsub('%', '\%')
|
|
43
|
-
end
|
|
44
|
-
|
|
45
|
-
def search_ready_jobs(term)
|
|
39
|
+
def search_ready_jobs(pattern)
|
|
46
40
|
SolidQueue::ReadyExecution
|
|
47
41
|
.joins(:job)
|
|
48
|
-
.where(
|
|
42
|
+
.where(matching_any(job_columns, pattern))
|
|
49
43
|
.includes(:job)
|
|
50
44
|
.limit(RESULTS_LIMIT)
|
|
51
45
|
end
|
|
52
46
|
|
|
53
|
-
def search_scheduled_jobs(
|
|
47
|
+
def search_scheduled_jobs(pattern)
|
|
54
48
|
SolidQueue::ScheduledExecution
|
|
55
49
|
.joins(:job)
|
|
56
|
-
.where(
|
|
50
|
+
.where(matching_any(job_columns, pattern))
|
|
57
51
|
.includes(:job)
|
|
58
52
|
.limit(RESULTS_LIMIT)
|
|
59
53
|
end
|
|
60
54
|
|
|
61
|
-
def search_failed_jobs(
|
|
55
|
+
def search_failed_jobs(pattern)
|
|
62
56
|
SolidQueue::FailedExecution
|
|
63
57
|
.joins(:job)
|
|
64
|
-
.where(
|
|
58
|
+
.where(matching_any(job_columns + [SolidQueue::FailedExecution.arel_table[:error]], pattern))
|
|
65
59
|
.includes(:job)
|
|
66
60
|
.limit(RESULTS_LIMIT)
|
|
67
61
|
end
|
|
68
62
|
|
|
69
|
-
def search_in_progress_jobs(
|
|
63
|
+
def search_in_progress_jobs(pattern)
|
|
70
64
|
SolidQueue::ClaimedExecution
|
|
71
65
|
.joins(:job)
|
|
72
|
-
.where(
|
|
66
|
+
.where(matching_any(job_columns, pattern))
|
|
73
67
|
.includes(:job)
|
|
74
68
|
.limit(RESULTS_LIMIT)
|
|
75
69
|
end
|
|
76
70
|
|
|
77
|
-
def search_completed_jobs(
|
|
71
|
+
def search_completed_jobs(pattern)
|
|
78
72
|
SolidQueue::Job
|
|
79
73
|
.where.not(finished_at: nil)
|
|
80
|
-
.where(
|
|
74
|
+
.where(matching_any(job_columns, pattern))
|
|
81
75
|
.order(finished_at: :desc)
|
|
82
76
|
.limit(RESULTS_LIMIT)
|
|
83
77
|
end
|
|
84
78
|
|
|
85
|
-
def search_recurring_tasks(
|
|
79
|
+
def search_recurring_tasks(pattern)
|
|
86
80
|
SolidQueue::RecurringTask
|
|
87
|
-
.where(
|
|
81
|
+
.where(matching_any(recurring_task_columns, pattern))
|
|
88
82
|
.limit(RESULTS_LIMIT)
|
|
89
83
|
end
|
|
90
84
|
|
|
91
|
-
def
|
|
92
|
-
|
|
93
|
-
solid_queue_jobs.class_name LIKE :term
|
|
94
|
-
OR solid_queue_jobs.queue_name LIKE :term
|
|
95
|
-
OR solid_queue_jobs.arguments LIKE :term
|
|
96
|
-
OR solid_queue_jobs.active_job_id LIKE :term
|
|
97
|
-
SQL
|
|
98
|
-
end
|
|
99
|
-
|
|
100
|
-
def failed_job_search_conditions
|
|
101
|
-
<<~SQL.squish
|
|
102
|
-
solid_queue_jobs.class_name LIKE :term
|
|
103
|
-
OR solid_queue_jobs.queue_name LIKE :term
|
|
104
|
-
OR solid_queue_jobs.arguments LIKE :term
|
|
105
|
-
OR solid_queue_jobs.active_job_id LIKE :term
|
|
106
|
-
OR solid_queue_failed_executions.error LIKE :term
|
|
107
|
-
SQL
|
|
85
|
+
def matching_any(columns, pattern)
|
|
86
|
+
columns.map { |column| column.matches(pattern, '\\') }.reduce(:or)
|
|
108
87
|
end
|
|
109
88
|
|
|
110
|
-
def
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
OR queue_name LIKE :term
|
|
114
|
-
OR arguments LIKE :term
|
|
115
|
-
OR active_job_id LIKE :term
|
|
116
|
-
SQL
|
|
89
|
+
def job_columns
|
|
90
|
+
jobs = SolidQueue::Job.arel_table
|
|
91
|
+
[jobs[:class_name], jobs[:queue_name], jobs[:arguments], jobs[:active_job_id]]
|
|
117
92
|
end
|
|
118
93
|
|
|
119
|
-
def
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
OR solid_queue_recurring_tasks.class_name LIKE :term
|
|
123
|
-
SQL
|
|
94
|
+
def recurring_task_columns
|
|
95
|
+
tasks = SolidQueue::RecurringTask.arel_table
|
|
96
|
+
[tasks[:key], tasks[:class_name]]
|
|
124
97
|
end
|
|
125
98
|
end
|
|
126
99
|
end
|
|
@@ -5,14 +5,18 @@ module SolidQueueMonitor
|
|
|
5
5
|
def self.calculate
|
|
6
6
|
scheduled = SolidQueue::ScheduledExecution.count
|
|
7
7
|
ready = SolidQueue::ReadyExecution.count
|
|
8
|
+
blocked = SolidQueue::BlockedExecution.count
|
|
8
9
|
failed = SolidQueue::FailedExecution.count
|
|
9
10
|
in_progress = SolidQueue::ClaimedExecution.count
|
|
10
11
|
recurring = SolidQueue::RecurringTask.count
|
|
11
12
|
|
|
12
13
|
{
|
|
13
|
-
|
|
14
|
+
# Jobs waiting to run or running. Failed jobs are left out: they only
|
|
15
|
+
# run again after a retry, and have their own card.
|
|
16
|
+
active_jobs: ready + scheduled + in_progress + blocked,
|
|
14
17
|
scheduled: scheduled,
|
|
15
18
|
ready: ready,
|
|
19
|
+
blocked: blocked,
|
|
16
20
|
failed: failed,
|
|
17
21
|
in_progress: in_progress,
|
|
18
22
|
recurring: recurring
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
<%= render 'stat_card', title: 'Ready', value: @stats[:ready] %>
|
|
6
6
|
<%= render 'stat_card', title: 'In Progress', value: @stats[:in_progress] %>
|
|
7
7
|
<%= render 'stat_card', title: 'Scheduled', value: @stats[:scheduled] %>
|
|
8
|
+
<%= render 'stat_card', title: 'Blocked', value: @stats[:blocked] %>
|
|
8
9
|
<%= render 'stat_card', title: 'Recurring', value: @stats[:recurring] %>
|
|
9
10
|
<%= render 'stat_card', title: 'Failed', value: @stats[:failed] %>
|
|
10
11
|
</div>
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: solid_queue_monitor
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 2.
|
|
4
|
+
version: 2.5.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Vishal Sadriya
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-11-
|
|
11
|
+
date: 2026-11-28 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: rails
|