-
Notifications
You must be signed in to change notification settings - Fork 107
Introduce support for task staleness threshold #1406
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
039de31
2ee0a43
22753d6
abde366
c011970
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| # frozen_string_literal: true | ||
|
|
||
| module Maintenance | ||
| class OutdatedTask < MaintenanceTasks::Task | ||
| def collection | ||
| [1, 2] | ||
| end | ||
|
|
||
| def process(number) | ||
| Rails.logger.debug("This task is outdated") | ||
| end | ||
| end | ||
| end |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -69,8 +69,13 @@ import_posts_task_succeeded_old: | |
| task_name: Maintenance::ImportPostsTask | ||
| tick_count: 10 | ||
| tick_total: 10 | ||
|
Comment on lines
68
to
71
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. CI is failing since these fields were erroneously deleted |
||
|
|
||
| outdated_task: | ||
| task_name: Maintenance::OutdatedTask | ||
| tick_count: 10 | ||
| tick_total: 10 | ||
| job_id: '123abc' | ||
| status: 'succeeded' | ||
| created_at: '01 Jan 2020 00:20:00' | ||
| started_at: '01 Jan 2020 00:40:36' | ||
| ended_at: '01 Jan 2020 00:52:19' | ||
| created_at: '03 Mar 2026 00:20:00' | ||
| started_at: '03 Mar 2026 00:40:36' | ||
| ended_at: '03 Mar 2026 00:52:19' | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -71,6 +71,18 @@ class TasksTest < ApplicationSystemTestCase | |
| assert_text(/January 01, 2020 01:00 Succeeded #\d/) | ||
| end | ||
|
|
||
| test "show a Task with outdated run" do | ||
| travel_to(maintenance_tasks_runs(:outdated_task).ended_at + 2.days) do | ||
| MaintenanceTasks.with(outdated_task_threshold: 1.day) do | ||
| visit maintenance_tasks_path | ||
|
|
||
| within page.find("a", text: "Maintenance::OutdatedTask").find(:xpath, "..").sibling(".has-text-warning") do |element| | ||
| assert_text "This task last ran 1 day ago. Consider removing it as it may be outdated." | ||
| end | ||
|
||
| end | ||
| end | ||
| end | ||
|
|
||
| test "task with attributes renders default values on the form" do | ||
| visit maintenance_tasks_path | ||
|
|
||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.