-
-
Notifications
You must be signed in to change notification settings - Fork 229
throttle ios events #361
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
throttle ios events #361
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -906,10 +906,10 @@ extension DownloadManagerModule { | |
| NSLog("[DownloadManager] Polling timer already running, skipping") | ||
| return | ||
| } | ||
| self.pollingTimer = Timer.scheduledTimer(withTimeInterval: 0.5, repeats: true) { [weak self] _ in | ||
| self.pollingTimer = Timer.scheduledTimer(withTimeInterval: 1.5, repeats: true) { [weak self] _ in | ||
| self?.pollProgress() | ||
| } | ||
| NSLog("[DownloadManager] Polling timer STARTED (0.5s interval)") | ||
| NSLog("[DownloadManager] Polling timer STARTED (1.5s interval)") | ||
|
Comment on lines
+909
to
+912
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. To improve maintainability and avoid magic numbers, it's a good practice to define the polling interval as a constant. This makes it easier to understand and modify the value in the future, and ensures consistency between the timer interval and the log message. let pollingInterval: TimeInterval = 1.5
self.pollingTimer = Timer.scheduledTimer(withTimeInterval: pollingInterval, repeats: true) { [weak self] _ in
self?.pollProgress()
}
NSLog("[DownloadManager] Polling timer STARTED (%.1fs interval)", pollingInterval)
Comment on lines
+909
to
+912
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The polling interval let interval: TimeInterval = 1.5
self.pollingTimer = Timer.scheduledTimer(withTimeInterval: interval, repeats: true) { [weak self] _ in
self?.pollProgress()
}
NSLog("[DownloadManager] Polling timer STARTED (\(interval)s interval)")References
|
||
| } | ||
| } | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The log message has been updated to reflect a 1.5s interval, but the actual Timer initialization on line 909 still uses 0.5 seconds. This creates a discrepancy where the events are not actually being throttled as intended by the PR description. Please update the withTimeInterval parameter on line 909 to 1.5 to match the log and the intended behavior.