-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Description
Overview
File I/O operations are being performed on the EDT (Event Dispatch Thread) during course update checks, which can freeze the UI.
Location
File: intellij-plugin/hs-core/src/org/hyperskill/academy/learning/stepik/hyperskill/update/HyperskillCourseUpdater.kt
Function: needUpdateCourseAdditionalFiles (lines 313-334)
Problem
The function file.loadEncodedContent() is wrapped in runWriteAction inside invokeAndWaitIfNeeded, which blocks the EDT. This is called in a loop during course update checks and can cause UI freezes.
val localFileContent = invokeAndWaitIfNeeded {
runWriteAction {
file.loadEncodedContent()
}
}What needs to be fixed
- Move file reading operations to a background thread using
ReadAction.compute()orReadAction.nonBlocking() - Keep only actual write operations in write actions
- The function is called in a loop, so the performance impact is significant
- Ensure proper threading model: IO operations should not block EDT
Tests understanding of
- EDT vs background thread operations
ReadAction/WriteActionproper usageinvokeAndWaitIfNeededgotchas- File system operations threading requirements
- Smart mode awareness
Validation
- Run IDE with the plugin and trigger course updates
- Ensure no UI freezes occur during course synchronization
- Add/modify tests to verify the fix
Estimated time
3-5 hours
Metadata
Metadata
Assignees
Labels
No labels