Skip to content

Fix #duration when #scheduled_at is nil#289

Open
ric2b wants to merge 4 commits intorails:mainfrom
ric2b:patch-1
Open

Fix #duration when #scheduled_at is nil#289
ric2b wants to merge 4 commits intorails:mainfrom
ric2b:patch-1

Conversation

@ric2b
Copy link
Copy Markdown

@ric2b ric2b commented Oct 19, 2025

Problem

When a job is enqueued without scheduled_at being set the app/views/mission_control/jobs/jobs/show.html.erb template breaks as the duration calculation currently expects scheduled_at to have a value.

Solution

Calculate the duration with enqueued_at if scheduled_at is nil.

Fixes #282

@ric2b
Copy link
Copy Markdown
Author

ric2b commented Oct 22, 2025

Looks like this might not be necessary after SolidQueue 1.2.2 was released? It includes this fix: rails/solid_queue#637

Although I'm not sure if ActiveJob expects every job to have scheduled_at populated or not, this might still be an issue in other backends if it's not mandatory.

@rosa
Copy link
Copy Markdown
Member

rosa commented Oct 28, 2025

I think this is a good idea regardless! Thank you.

@qichunren
Copy link
Copy Markdown

When will this be merged?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

job.scheduled_at cannot be assumed and crashes job.duration

3 participants