mirror of
https://github.com/pocket-id/pocket-id.git
synced 2025-12-06 09:13:19 +03:00
[PR #585] [MERGED] fix: run jobs at interval instead of specific time #714
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/pocket-id/pocket-id/pull/585
Author: @ItalyPaleAle
Created: 5/29/2025
Status: ✅ Merged
Merged: 5/29/2025
Merged by: @stonith404
Base:
main← Head:background-job📝 Commits (6)
194a8e1fix: run jobs at interval instead of specific timee38fd91Use a single transaction for all DB cleanup jobs126f9c2Should have been 24 hours7c8c9a1Log job start too4f94a6aFix logging and errors12b15d5Move back to multiple jobs, but with jitter📊 Changes
7 files changed (+105 additions, -46 deletions)
View changed files
📝
backend/internal/job/analytics_job.go(+3 -1)📝
backend/internal/job/api_key_expiry_job.go(+10 -6)📝
backend/internal/job/db_cleanup_job.go(+55 -20)📝
backend/internal/job/file_cleanup_job.go(+7 -4)📝
backend/internal/job/geoloite_update_job.go(+5 -2)📝
backend/internal/job/ldap_job.go(+4 -1)📝
backend/internal/job/scheduler.go(+21 -12)📄 Description
While this is helpful for all jobs, it's particularly useful for the analytics job, to avoid all instances to send the ping at the exact same time, and to make sure it's always about 24 hours away.
Additionally, runs all database cleanup jobs in a single transaction, to avoid contention when all cleanup jobs are started at the same time (since they'd be competing to lock the database, especially with SQLite).
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.