Skip to content

Commit

Permalink
Fixing setEventHandler func in Scheduler struct
Browse files Browse the repository at this point in the history
  • Loading branch information
FabrizioBrancati committed May 25, 2020
1 parent f0ce788 commit 2538480
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
8 changes: 2 additions & 6 deletions Sources/Queuer/Scheduler.swift
Expand Up @@ -56,9 +56,7 @@ public struct Scheduler {
timer = DispatchSource.makeTimerSource()
timer.schedule(deadline: deadline, repeating: repeating)
if let handler = handler {
timer.setEventHandler(qos: qualityOfService) {
handler()
}
timer.setEventHandler(qos: qualityOfService, handler: handler)
timer.resume()
}
}
Expand All @@ -69,9 +67,7 @@ public struct Scheduler {
public mutating func setHandler(_ handler: @escaping () -> Void) {
self.handler = handler

timer.setEventHandler(qos: qualityOfService) {
handler()
}
timer.setEventHandler(qos: qualityOfService, handler: handler)
timer.resume()
}
}
1 change: 1 addition & 0 deletions Tests/QueuerTests/SchedulerTests.swift
Expand Up @@ -45,6 +45,7 @@ internal class SchedulerTests: XCTestCase {
waitForExpectations(timeout: 5) { error in
XCTAssertNil(error)
XCTAssertEqual(order, [0, 0, 0, 0])
schedule.timer.cancel()
}
}

Expand Down

0 comments on commit 2538480

Please sign in to comment.