mirror of https://github.com/oxen-io/session-ios
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
22 lines
573 B
Swift
22 lines
573 B
Swift
5 years ago
|
|
||
|
public final class JobQueue : JobDelegate {
|
||
|
|
||
|
public static let shared = JobQueue()
|
||
|
|
||
|
public func add(_ job: Job, using transaction: Any) {
|
||
|
Configuration.shared.storage.persist(job, using: transaction)
|
||
|
job.delegate = self
|
||
|
job.execute()
|
||
|
}
|
||
|
|
||
|
public func handleJobSucceeded(_ job: Job) {
|
||
|
// Mark the job as succeeded
|
||
|
}
|
||
|
|
||
|
public func handleJobFailed(_ job: Job, with error: Error) {
|
||
|
// Persist the job
|
||
|
// Retry it if the max failure count hasn't been reached
|
||
|
// Propagate the error otherwise
|
||
|
}
|
||
|
}
|