-
Notifications
You must be signed in to change notification settings - Fork 89
Open
Description
for such testcase
func test_throttleFirstImmediateFire() {
let exp = expectation(description: "Run twice and call immediately")
var value = 0
let extractedExpr = Throttler(time: .milliseconds(500), immediateFire: true, {
value += 1
})
self.throttle = extractedExpr
self.throttle?.call()
self.throttle?.call()
self.throttle?.call()
self.throttle?.call()
self.throttle?.call()
DispatchQueue.main.asyncAfter(deadline: .now() + .seconds(1)) {
if value == 2 {
exp.fulfill()
} else {
XCTAssert(value == 2, "Failed to throttle, calls were not ignored.")
}
}
self.wait(for: [exp], timeout: 1)
}expect value == 2, first time and second time after 500ms.
but, this test case failed,
I guess
queue.asyncAfter(deadline: dispatchTime, execute: callbackJob) was cancel by second call()
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels