Skip to content

Commit

Permalink
fix(core): ensure thread safety in BaseCodeGenTask.kt
Browse files Browse the repository at this point in the history
Ensure thread safety by wrapping promptText() method call inside a runReadAction block. This prevents potential concurrency issues in the BaseCodeGenTask class.
  • Loading branch information
phodal committed Jul 1, 2024
1 parent 379b006 commit 4479e8a
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ open class BaseCodeGenTask(private val request: CodeCompletionRequest) :
indicator.fraction = 0.1
indicator.text = ShireCoreBundle.message("intentions.step.prepare-context")

val prompt = promptText()
val prompt = runReadAction { promptText() }

val flow: Flow<String> = LlmProvider.provider(request.project)!!.stream(prompt, "", false)
logger.info("Prompt: $prompt")
Expand Down

0 comments on commit 4479e8a

Please sign in to comment.