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

Loading…
Cancel
Save