Closed ekvedaras closed 2 months ago
ReadAction.nonBlocking<Unit> {
TableAndAliasCollector(this).collect()
DbReferenceResolver(this).resolve()
}.inSmartMode(project).expireWith(expressionDisposable).executeSynchronously()
It means that the actions inside ReadAction.nonBlocking
block will be executed on the current thread, therefore tests and following actions during plugin execution will wait till the end of ReadAction.nonBlocking
The tests will be passed, but make sure that
TableAndAliasCollector(this).collect()
DbReferenceResolver(this).resolve()
is an idempotent operations block, because ReadAction.nonBlocking
will be restarted on any UI actions (typing, etc.)
How did I miss .executeSynchronously()
... 🙈
@ekvedaras Hi! The fact that this approach did not lead to the problem's fix means that you probably do not have enough cancellation points in the code (https://plugins.jetbrains.com/docs/intellij/general-threading-rules.html#read-action-cancellability). Please try to use ProgressManager.checkCanceled()
between DB calls. For example, you could use it as a first command in every iteration of forEach
-es in DbReferenceResolver.kt.
Attempting to use
ReadAction.nonBlocking
andDisposable