Fix crash

pull/460/head
Niels Andriesse 4 years ago
parent 08a3f3b476
commit f0295fb469

@ -47,7 +47,7 @@ public final class JobQueue : NSObject, JobDelegate {
}
public func handleJobSucceeded(_ job: Job) {
JobQueue.currentlyExecutingJobs.remove(job.id!)
given(job.id) { JobQueue.currentlyExecutingJobs.remove($0) }
SNMessagingKitConfiguration.shared.storage.write(with: { transaction in
SNMessagingKitConfiguration.shared.storage.markJobAsSucceeded(job, using: transaction)
}, completion: {
@ -56,7 +56,7 @@ public final class JobQueue : NSObject, JobDelegate {
}
public func handleJobFailed(_ job: Job, with error: Error) {
JobQueue.currentlyExecutingJobs.remove(job.id!)
given(job.id) { JobQueue.currentlyExecutingJobs.remove($0) }
job.failureCount += 1
let storage = SNMessagingKitConfiguration.shared.storage
guard !storage.isJobCanceled(job) else { return SNLog("\(type(of: job)) canceled.") }
@ -78,7 +78,7 @@ public final class JobQueue : NSObject, JobDelegate {
}
public func handleJobFailedPermanently(_ job: Job, with error: Error) {
JobQueue.currentlyExecutingJobs.remove(job.id!)
given(job.id) { JobQueue.currentlyExecutingJobs.remove($0) }
job.failureCount += 1
let storage = SNMessagingKitConfiguration.shared.storage
storage.write(with: { transaction in

Loading…
Cancel
Save