File tree Expand file tree Collapse file tree 3 files changed +16
-4
lines changed Expand file tree Collapse file tree 3 files changed +16
-4
lines changed Original file line number Diff line number Diff line change 12
12
- Change signature of Limit(Int) to Limit(Double)
13
13
14
14
#### Fix
15
+ - Deadline now cancel the job properly (#98 )
15
16
- Fix calling ` done ` after termination will remove the lastError (#97 )
16
17
- Breaking support for Swift 3.2 (#75 )
17
18
Original file line number Diff line number Diff line change @@ -15,11 +15,16 @@ internal final class DeadlineConstraint: JobConstraint {
15
15
}
16
16
17
17
func run( operation: SqOperation ) -> Bool {
18
- if let delay = operation. info. deadline {
19
- runInBackgroundAfter ( delay. timeIntervalSince ( Date ( ) ) , callback: { [ weak operation] in
20
- operation? . run ( )
21
- } )
18
+ guard let delay = operation. info. deadline else {
19
+ return true
22
20
}
21
+
22
+ runInBackgroundAfter ( delay. timeIntervalSince ( Date ( ) ) , callback: { [ weak operation] in
23
+ guard let ope = operation else { return }
24
+ guard !ope. isFinished else { return }
25
+
26
+ ope. cancel ( with: . deadline)
27
+ } )
23
28
return true
24
29
}
25
30
Original file line number Diff line number Diff line change @@ -66,6 +66,12 @@ internal final class SqOperation: Operation {
66
66
super. cancel ( )
67
67
}
68
68
69
+ func cancel( with: SwiftQueueError ) {
70
+ lastError = with
71
+ onTerminate ( )
72
+ super. cancel ( )
73
+ }
74
+
69
75
func onTerminate( ) {
70
76
if isExecuting {
71
77
isFinished = true
You can’t perform that action at this time.
0 commit comments