Skip to content

Commit

Permalink
Merge pull request #1 from keisukeYamagishi/fix/change-guard-flag-log…
Browse files Browse the repository at this point in the history
…ic-timing

guard" statement has been changed.
  • Loading branch information
keisukeYamagishi authored Apr 10, 2023
2 parents 996a432 + 89e607f commit ec2e2e1
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion Sources/Throttle/Throttle.swift
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ public class Throttle {
public func execute(interval: DispatchTimeInterval,
emit: @escaping (() -> Void))
{
guard !_isStartTimer else { return }

let currentDate = _now
let timeInterval: DispatchTimeInterval
if let lastSendingTime = _lastSentTime {
Expand All @@ -29,7 +31,6 @@ public class Throttle {
} else {
timeInterval = .nanoseconds(0)
}
guard !_isStartTimer else { return }

if timeInterval.isNow {
_lastSentTime = _now
Expand Down

0 comments on commit ec2e2e1

Please sign in to comment.