maintenance_tasks 2.13.0 → 2.15.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 +49 -3
- data/app/controllers/maintenance_tasks/application_controller.rb +1 -1
- data/app/helpers/maintenance_tasks/tasks_helper.rb +1 -1
- data/app/jobs/concerns/maintenance_tasks/task_job_concern.rb +15 -3
- data/app/models/concerns/maintenance_tasks/run_concern.rb +567 -0
- data/app/models/maintenance_tasks/run.rb +1 -513
- data/app/models/maintenance_tasks/runner.rb +2 -0
- data/app/models/maintenance_tasks/task_data_index.rb +9 -0
- data/app/views/layouts/maintenance_tasks/_navbar.html.erb +1 -1
- data/app/views/layouts/maintenance_tasks/application.html.erb +43 -12
- data/app/views/maintenance_tasks/runs/_run.html.erb +1 -1
- data/app/views/maintenance_tasks/runs/info/_errored.html.erb +1 -1
- data/app/views/maintenance_tasks/runs/info/_paused.html.erb +1 -1
- data/app/views/maintenance_tasks/runs/info/_running.html.erb +1 -1
- data/app/views/maintenance_tasks/runs/info/_succeeded.html.erb +0 -1
- data/app/views/maintenance_tasks/tasks/_task.html.erb +13 -1
- data/app/views/maintenance_tasks/tasks/index.html.erb +2 -2
- data/app/views/maintenance_tasks/tasks/show.html.erb +2 -2
- data/db/migrate/20251128180556_add_cursor_is_json_flag_to_runs.rb +7 -0
- data/lib/maintenance_tasks.rb +36 -0
- metadata +5 -3
|
@@ -14,9 +14,9 @@
|
|
|
14
14
|
<% end %>
|
|
15
15
|
<% if new_tasks = @available_tasks[:new] %>
|
|
16
16
|
<h3 class="title is-4 has-text-weight-bold">New Tasks</h3>
|
|
17
|
-
|
|
17
|
+
<div class="grid is-col-min-20">
|
|
18
18
|
<%= render partial: 'task', collection: new_tasks %>
|
|
19
|
-
|
|
19
|
+
</div>
|
|
20
20
|
<% end %>
|
|
21
21
|
<% if completed_tasks = @available_tasks[:completed] %>
|
|
22
22
|
<h3 class="title is-4 has-text-weight-bold">Completed Tasks</h3>
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
|
|
45
45
|
<%= tag.div(data: { refresh: @task.refresh? || "" }) do %>
|
|
46
46
|
<% if @task.active_runs.any? %>
|
|
47
|
-
<hr
|
|
47
|
+
<hr>
|
|
48
48
|
|
|
49
49
|
<h4 class="title is-4">Active Runs</h4>
|
|
50
50
|
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
<% end %>
|
|
53
53
|
|
|
54
54
|
<% if @task.runs_page.records.present? %>
|
|
55
|
-
<hr
|
|
55
|
+
<hr>
|
|
56
56
|
|
|
57
57
|
<h4 class="title is-5 has-text-weight-bold">Previous Runs</h4>
|
|
58
58
|
|
data/lib/maintenance_tasks.rb
CHANGED
|
@@ -109,6 +109,42 @@ module MaintenanceTasks
|
|
|
109
109
|
# @return [Boolean] whether to report unexpected errors as handled (true) or unhandled (false).
|
|
110
110
|
mattr_accessor :report_errors_as_handled, default: true
|
|
111
111
|
|
|
112
|
+
# @!attribute serialize_cursors_as_json
|
|
113
|
+
# @scope class
|
|
114
|
+
# Controls whether or not cursor values are stored as JSON in the database.
|
|
115
|
+
# Defaults to false.
|
|
116
|
+
#
|
|
117
|
+
# Storing cursors as JSON enables more complex cursor structures. For
|
|
118
|
+
# example, with JSON cursors a task can iterate over collections using
|
|
119
|
+
# multiple fields or columns to track progress. This is particularly useful
|
|
120
|
+
# for iterating over models with composite primary keys.
|
|
121
|
+
#
|
|
122
|
+
# Be advised that this feature comes with a few caveats:
|
|
123
|
+
#
|
|
124
|
+
# 1. Cursor values must be capable of being serialized to JSON and parsed
|
|
125
|
+
# from JSON. If they are not, errors will occur during task execution.
|
|
126
|
+
# 2. If a cursor contains a value that loses precision when serialized, it
|
|
127
|
+
# may lead to unexpected behaviour.
|
|
128
|
+
# 3. This feature utilizes a string column to store the JSON data. If your
|
|
129
|
+
# database has a hard limit on how big a string value can be, be mindful
|
|
130
|
+
# that certain cursor structures could result in a value that could exceed
|
|
131
|
+
# that limit and cause issues.
|
|
132
|
+
#
|
|
133
|
+
# A new column was added to discern JSON cursors from plain string cursors.
|
|
134
|
+
# Make sure you have run the latest database migrations provided by the gem
|
|
135
|
+
# before enabling this feature.
|
|
136
|
+
#
|
|
137
|
+
# @return [Boolean] whether or not to store cursor values as JSON.
|
|
138
|
+
mattr_accessor :serialize_cursors_as_json, default: false
|
|
139
|
+
|
|
140
|
+
# @!attribute task_staleness_threshold
|
|
141
|
+
# @scope class
|
|
142
|
+
# The threshold after which a task is considered stale.
|
|
143
|
+
# Defaults to 30 days. Can be disabled by setting this to `false`.
|
|
144
|
+
#
|
|
145
|
+
# @return [ActiveSupport::Duration, false] time interval after which a task is considered stale.
|
|
146
|
+
mattr_accessor :task_staleness_threshold, default: 30.days
|
|
147
|
+
|
|
112
148
|
class << self
|
|
113
149
|
DEPRECATION_MESSAGE = "MaintenanceTasks.error_handler is deprecated and will be removed in the 3.0 release. " \
|
|
114
150
|
"Instead, reports will be sent to the Rails error reporter. Do not set a handler and subscribe " \
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: maintenance_tasks
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 2.
|
|
4
|
+
version: 2.15.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Shopify Engineering
|
|
@@ -122,6 +122,7 @@ files:
|
|
|
122
122
|
- app/helpers/maintenance_tasks/tasks_helper.rb
|
|
123
123
|
- app/jobs/concerns/maintenance_tasks/task_job_concern.rb
|
|
124
124
|
- app/jobs/maintenance_tasks/task_job.rb
|
|
125
|
+
- app/models/concerns/maintenance_tasks/run_concern.rb
|
|
125
126
|
- app/models/maintenance_tasks/application_record.rb
|
|
126
127
|
- app/models/maintenance_tasks/batch_csv_collection_builder.rb
|
|
127
128
|
- app/models/maintenance_tasks/csv_collection_builder.rb
|
|
@@ -166,6 +167,7 @@ files:
|
|
|
166
167
|
- db/migrate/20220706101937_change_runs_tick_columns_to_bigints.rb
|
|
167
168
|
- db/migrate/20220713131925_add_index_on_task_name_and_status_to_runs.rb
|
|
168
169
|
- db/migrate/20230622035229_add_metadata_to_runs.rb
|
|
170
|
+
- db/migrate/20251128180556_add_cursor_is_json_flag_to_runs.rb
|
|
169
171
|
- exe/maintenance_tasks
|
|
170
172
|
- lib/generators/maintenance_tasks/install_generator.rb
|
|
171
173
|
- lib/generators/maintenance_tasks/task_generator.rb
|
|
@@ -182,7 +184,7 @@ homepage: https://github.com/Shopify/maintenance_tasks
|
|
|
182
184
|
licenses:
|
|
183
185
|
- MIT
|
|
184
186
|
metadata:
|
|
185
|
-
source_code_uri: https://github.com/Shopify/maintenance_tasks/tree/v2.
|
|
187
|
+
source_code_uri: https://github.com/Shopify/maintenance_tasks/tree/v2.15.0
|
|
186
188
|
allowed_push_host: https://rubygems.org
|
|
187
189
|
rdoc_options: []
|
|
188
190
|
require_paths:
|
|
@@ -198,7 +200,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
198
200
|
- !ruby/object:Gem::Version
|
|
199
201
|
version: '0'
|
|
200
202
|
requirements: []
|
|
201
|
-
rubygems_version:
|
|
203
|
+
rubygems_version: 4.0.10
|
|
202
204
|
specification_version: 4
|
|
203
205
|
summary: A Rails engine for queuing and managing maintenance tasks
|
|
204
206
|
test_files: []
|