throttle ios events#361
Conversation
There was a problem hiding this comment.
Your free trial has ended. If you'd like to continue receiving code reviews, you can add a payment method here.
There was a problem hiding this comment.
Code Review
This pull request updates the application version to 0.0.93 across Android, iOS, and the package configuration, while also modifying iOS project settings related to code signing and build paths. Feedback is provided regarding a discrepancy in the download manager, where the polling timer's log message was updated to 1.5s, but the actual timer interval remains at 0.5s, resulting in a mismatch between the code's behavior and its logging.
| self?.pollProgress() | ||
| } | ||
| NSLog("[DownloadManager] Polling timer STARTED (0.5s interval)") | ||
| NSLog("[DownloadManager] Polling timer STARTED (1.5s interval)") |
There was a problem hiding this comment.
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.
900eb7b to
2f3991a
Compare
change freq from 0.5 s to 1.5s and upgrade ios and android build files to 0.0.93 version Co-Authored-By: Dishit Karia <hanmadishit74@gmail.com>
2f3991a to
7ee3b91
Compare
|
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request updates the application version to 0.0.93 across Android, iOS, and the package manifest. Additionally, it increases the download progress polling interval in the iOS DownloadManagerModule from 0.5 to 1.5 seconds. Feedback suggests defining this polling interval as a constant to avoid magic numbers and improve maintainability.
| 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)") |
There was a problem hiding this comment.
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)|
Fixed — updated |
There was a problem hiding this comment.
Code Review
This pull request updates the application version to 0.0.93 across Android, iOS, and the package configuration. Additionally, the download progress polling interval in the iOS DownloadManagerModule has been increased from 0.5 to 1.5 seconds. Feedback was provided to avoid hardcoding this interval value by defining it as a constant, which would improve maintainability and ensure consistency between the timer logic and the log messages.
| 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)") |
There was a problem hiding this comment.
The polling interval 1.5 is hardcoded in both the timer initialization and the log message. Defining this as a constant improves maintainability and ensures that updates to the interval are reflected consistently across the module, similar to how DEFAULT_PROGRESS_INTERVAL is used in the Android implementation.
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
- Avoid hardcoding configuration values like polling intervals. Define them as constants for better maintainability and consistency.



change freq from 0.5 s to 1.5s
and upgrade ios and android build files to 0.0.93 version
Summary
Type of Change
Screenshots / Screen Recordings
Android
iOS
Checklist
General
Testing
npm test)React Native Specific
project.pbxproj)SPACING/TYPOGRAPHYconstants from the themeuseThemedStylespattern (not inline or staticStyleSheet.create)FlatList/FlashList(not.map()insideScrollView)Performance & Models
/vs\\)Security
Related Issues
Additional Notes