Fix file open retry in ydocs server (#10787)

There is a code for exponential back off, but the result with error was lost at one place.

Tested by mocking timeouts in our `lanugageServer.ts`

Fixes #10606
This commit is contained in:
Adam Obuchowicz 2024-08-12 11:57:29 +02:00 committed by GitHub
parent 0f5a3a78b1
commit 09c4b7a993
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -396,7 +396,7 @@ class ModulePersistence extends ObservableV2<{ removed: () => void }> {
return Ok()
}
case LsSyncState.Closed: {
await this.withState(LsSyncState.Opening, async () => {
return await this.withState(LsSyncState.Opening, async () => {
const promise = this.ls.openTextFile(this.path)
this.setLastAction(promise.then(res => !res.ok && this.setState(LsSyncState.Closed)))
const result = await promise
@ -409,7 +409,6 @@ class ModulePersistence extends ObservableV2<{ removed: () => void }> {
this.syncFileContents(result.value.content, result.value.currentVersion)
return Ok()
})
return Ok()
}
default: {
assertNever(this.state)