Skip to content

Commit

Permalink
fix: change throttler intervel from 0.2 to 0.3, reduce cpu
Browse files Browse the repository at this point in the history
  • Loading branch information
tisfeng committed Nov 15, 2024
1 parent c713236 commit 78abbde
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion Easydict/Swift/Utility/Throttler.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@ import Foundation
class Throttler {
// MARK: Lifecycle

init(maxInterval: TimeInterval = 0.2, queue: DispatchQueue = DispatchQueue.main) {
/// - Parameters:
/// - maxInterval: The maximum interval between executions. This value should be greater than 0.2s, otherwise it may update UI too frequently, cause CPU too high.
/// - queue: The dispatch queue to execute the block on.
init(maxInterval: TimeInterval = 0.3, queue: DispatchQueue = DispatchQueue.main) {
self.maxInterval = maxInterval
self.queue = queue
}
Expand Down

0 comments on commit 78abbde

Please sign in to comment.