-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Description
Overview
Test file recreation (anti-cheating mechanism) blocks background threads unnecessarily during task checking, potentially causing performance issues.
Location
File: intellij-plugin/hs-core/src/org/hyperskill/academy/learning/actions/CheckAction.kt
Function: recreateTestFiles (lines 167-194)
Problem
Test file recreation is done synchronously during check with invokeAndWaitIfNeeded + runWriteAction. This blocks the background thread that's running the check operation.
override fun run(indicator: ProgressIndicator) {
// Running on background thread
recreateTestFiles(project, task) // But this blocks with invokeAndWaitIfNeeded
}What needs to be fixed
- The operation is already on a background thread (line 133
run(indicator: ProgressIndicator)) but usesinvokeAndWaitIfNeededwhich blocks unnecessarily - Consider using
runWriteActionAndWaitor restructuring to avoid blocking - Add proper error handling for individual file recreation failures (currently just logs warnings)
- The same pattern exists in
FrameworkLessonManagerImpl.recreateTestFiles(lines 219-245) - fix both locations consistently
Tests understanding of
- Background task threading in IntelliJ Platform
- When to use
invokeAndWaitIfNeededvs other patterns - Write action requirements and proper usage
- Progress indicator usage
- Command processor for undo/redo support
- Anti-cheating mechanisms in educational plugins
Validation
- Create a task with many test files
- Run checker repeatedly and measure performance
- Ensure smooth operation without blocking
- Verify files are still recreated correctly
Estimated time
3-4 hours
Metadata
Metadata
Assignees
Labels
No labels