-
-
Notifications
You must be signed in to change notification settings - Fork 1
Jobs retention #29
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
Jobs retention #29
Conversation
thoven87
commented
Mar 18, 2025
- Adding job retention configuration
- Make job priority static vars instead of static func
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A couple of comments
Sorry I'm wondering if we do this another way. Basically the retention policy is retain or not, without a timeout. Then we add a function for users to call. func purgeRetainedJobsEarlierThan(cancelled: Date, finished: Date, failed: Date) { Actually you could just update the Then users could add their own scheduled job. We could even write the job for them struct PurgeOldJobs: JobParameters {
let jobQueue: JobQueue<PostgresJobQueue>
}
jobQueue.registerJob(parameters: PurgeOldJobs.self) { parameters,_ in
parameters.jobQueue.cleanUp(
cancelledJobs: .remove(olderThan: .now - 4*24*60*60),
finishedJobs: .remove(olderThan: .now - 7*24*60*60)
)
}
jobSchedule = JobSchedule(job: PurgeOldJobs.self, .onMinutes(0,10,20,30,40,50)) I know this ends up being more work for the user, but it makes it a lot more configurable |
I think this works better and also maybe introduce a job rescue (orphan jobs :))? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any reason you want to keep this separate from cleanup function. Also making the retain times parameters of the function instead of static data might make it flexible.
func updateJob(id: JobID, buffer: ByteBuffer, connection: PostgresConnection) async throws { | ||
/// Helper func which to be use by a scheduled jobs | ||
/// for performing job clean up based on a given set of policies | ||
public func processDataRetentionPolicy() async throws { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Given we are expecting people to set up a Job to call this, why don't we provide them with one.
The notification from yesterday was because I merged the main branch into this branch. I have a few meetings today and should have the updated logic in by this weekend. |
I have thought of this implementation for a while, implementing as suggested will require |