@@ -134,6 +134,7 @@ class JvmNavigationDiscoveryManager(private val project: Project, private val cs
134134 Log .trace(logger, project, " launching startup job" )
135135 startupJob?.cancel(CancellationException (" new startup job started" ))
136136 startupJob = cs.launchWithErrorReporting(" ${this ::class .java.simpleName} .StartupJob" , logger) {
137+ coroutineContext.ensureActive()
137138 Log .trace(logger, project, " Starting startup job" )
138139 var count = 0
139140 val jobTime = measureTimeMillis {
@@ -187,11 +188,13 @@ class JvmNavigationDiscoveryManager(private val project: Project, private val cs
187188 Log .trace(logger, project, " launching processing job" )
188189 processingJob?.cancel(CancellationException (" new job started" ))
189190 processingJob = cs.launchWhileActiveWithErrorReporting(10 .seconds, 30 .seconds, " ${this ::class .java.simpleName} .ProcessingTask" , logger) {
191+ coroutineContext.ensureActive()
190192 DumbService .getInstance(project).waitForSmartMode()
191- ensureActive()
193+ coroutineContext. ensureActive()
192194 // peek the file, remove it only if processing finished successfully.
193195 var file = candidateFiles.peek()
194196 while (file != null ) {
197+ coroutineContext.ensureActive()
195198 val isInContent = readAction {
196199 ProjectFileIndex .getInstance(project).isInContent(file)
197200 }
@@ -203,14 +206,16 @@ class JvmNavigationDiscoveryManager(private val project: Project, private val cs
203206
204207 Log .trace(logger, project, " Processing candidate file {}" , file.url)
205208 val fileProcessingTime = measureTimeMillis {
209+ coroutineContext.ensureActive()
206210 val fileInfo = FileDiscoveryInfoBuilder .getInstance(project).buildFileInfo(file)
211+ coroutineContext.ensureActive()
207212 Log .trace(logger, project, " Built fileInfo for candidate file {} [{}]" , file.url, fileInfo)
208213 JvmSpanNavigationProvider .getInstance(project).processCandidateFile(fileInfo)
209214 JvmEndpointNavigationProvider .getInstance(project).processCandidateFile(fileInfo)
210215 candidateFiles.remove(file)
211216 }
212217 Log .trace(logger, project, " Finished processing candidate file {} in {} ms" , file.url, fileProcessingTime)
213- ensureActive()
218+ coroutineContext. ensureActive()
214219 file = candidateFiles.peek()
215220 }
216221 }
0 commit comments