auto-dev icon indicating copy to clipboard operation
auto-dev copied to clipboard

sketchwindows update finish Concurrent problem

Open SuperCoderMan521 opened this issue 1 year ago • 1 comments

Describe the bug **fun onUpdate(text: String) { myText = text val codeFenceList = CodeFence.parseAll(text) runInEdt { ......**


**AutoDevCoroutineScope.workerScope(project).launch { flow.cancelHandler { toolWindow.handleCancel = it }.cancellable().collect { char -> suggestion.append(char) toolWindow.onUpdate(suggestion.toString()) } toolWindow.onFinish(suggestion.toString()) }**

Because the update method is executed in the edt thread, the parsing logic is relatively heavy, which will cause the actual processing speed to be much lower than the token delivery speed. This will result in the update being delivered with all tokens, but the edt has not processed all tokens, and a "finish" will appear Executing it in advance will lead to some unexpected disorders in the interaction

Because the number of tokens is unpredictable, perhaps this problem can be solved through the dynamic features of juc Phaser

SuperCoderMan521 avatar Jun 14 '25 06:06 SuperCoderMan521

same to #412

phodal avatar Jun 21 '25 15:06 phodal