Process queued background jobs before re-trying stalled
This commit is contained in:
parent
6604ea8a2b
commit
779d4e7287
2 changed files with 12 additions and 3 deletions
|
@ -10,6 +10,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
|
||||||
|
|
||||||
- Limit number of mentions and links in remote posts.
|
- Limit number of mentions and links in remote posts.
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
- Process queued background jobs before re-trying stalled.
|
||||||
|
|
||||||
## [1.19.0] - 2023-03-30
|
## [1.19.0] - 2023-03-30
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
|
|
@ -48,11 +48,16 @@ pub async fn get_job_batch(
|
||||||
job_type = $2
|
job_type = $2
|
||||||
AND scheduled_for < CURRENT_TIMESTAMP
|
AND scheduled_for < CURRENT_TIMESTAMP
|
||||||
AND (
|
AND (
|
||||||
job_status = $3 --queued
|
-- queued
|
||||||
OR job_status = $1 --running
|
job_status = $3
|
||||||
|
-- running
|
||||||
|
OR job_status = $1
|
||||||
AND updated_at < CURRENT_TIMESTAMP - $5::text::interval
|
AND updated_at < CURRENT_TIMESTAMP - $5::text::interval
|
||||||
)
|
)
|
||||||
ORDER BY scheduled_for ASC
|
ORDER BY
|
||||||
|
-- queued jobs first
|
||||||
|
job_status ASC,
|
||||||
|
scheduled_for ASC
|
||||||
LIMIT $4
|
LIMIT $4
|
||||||
)
|
)
|
||||||
RETURNING background_job
|
RETURNING background_job
|
||||||
|
|
Loading…
Reference in a new issue