Skip to content

Commit 2acbe60

Browse files
committed
Actually set the current facet refresh Job
1 parent 01146d9 commit 2acbe60

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/main/kotlin/facet/MinecraftFacetDetector.kt

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ import kotlinx.coroutines.CoroutineScope
5454
import kotlinx.coroutines.Dispatchers
5555
import kotlinx.coroutines.Job
5656
import kotlinx.coroutines.cancelAndJoin
57+
import kotlinx.coroutines.job
5758
import kotlinx.coroutines.launch
5859
import org.jetbrains.plugins.gradle.util.GradleUtil
5960

@@ -68,8 +69,9 @@ class MinecraftFacetDetector : ProjectActivity {
6869

6970
override suspend fun execute(project: Project) {
7071
val detectorService = project.service<FacetDetectorScopeProvider>()
71-
detectorService.currentJob?.let { it.cancelAndJoin() }
72+
detectorService.currentJob?.cancelAndJoin()
7273
withBackgroundProgress(project, "Detecting Minecraft Frameworks", cancellable = false) {
74+
detectorService.currentJob = coroutineContext.job
7375
MinecraftModuleRootListener.doCheck(project)
7476
}
7577
}
@@ -88,8 +90,9 @@ class MinecraftFacetDetector : ProjectActivity {
8890
val project = event.source as? Project ?: return
8991
val detectorService = project.service<FacetDetectorScopeProvider>()
9092
detectorService.scope.launch {
91-
detectorService.currentJob?.let { it.cancelAndJoin() }
93+
detectorService.currentJob?.cancelAndJoin()
9294
withBackgroundProgress(project, "Detecting Minecraft Frameworks", cancellable = false) {
95+
detectorService.currentJob = coroutineContext.job
9396
doCheck(project)
9497
}
9598
}

0 commit comments

Comments
 (0)