Skip to content

Commit

Permalink
fix(mps-sync-plugin): handle exceptions during initial sync
Browse files Browse the repository at this point in the history
  • Loading branch information
slisson committed Feb 28, 2025
1 parent 73cc5c5 commit 8a07819
Showing 1 changed file with 12 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package org.modelix.mps.sync3

import com.intellij.openapi.application.ApplicationManager
import com.intellij.openapi.application.ModalityState
import io.ktor.utils.io.CancellationException
import jetbrains.mps.project.MPSProject
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Job
Expand Down Expand Up @@ -91,7 +92,17 @@ class BindingWorker(

private suspend fun CoroutineScope.syncJob() {
// initial sync
initialSync()
while (isActive()) {
try {
initialSync()
break
} catch (ex: CancellationException) {
break
} catch (ex: Exception) {
LOG.error(ex) { "Initial synchronization failed" }
delay(5_000)
}
}

// continuous sync to MPS
launchLoop {
Expand Down

0 comments on commit 8a07819

Please sign in to comment.