Don't wait on runtime confirmation when opening

Ydoc doesn't like delays so if opening a file takes a considerably more
time than usual (locking, more files to compile), ydoc will bail and
fail to initiialize properly. This is rather trivially reproducible by
adding `Thread.sleep(20*000)` to OpenFileCmd but automatic testing is
non-trivial.
This commit is contained in:
Hubert Plociniczak 2024-07-19 00:55:08 +02:00
parent 451d7cb452
commit fccb9500e1

View File

@ -179,13 +179,10 @@ class CollaborativeBuffer(
)
} else {
logger.warn("Timeout reached when awaiting response from the server")
replyTo ! OpenFileResponse(Left(OperationTimeout))
stop(Map.empty)
}
case Api.Response(Some(id), Api.OpenFileResponse) if id == requestId =>
timeout.cancel()
val cap = CapabilityRegistration(CanEdit(bufferPath))
replyTo ! OpenFileResponse(Right(OpenFileResult(buffer, Some(cap))))
unstashAll()
context.become(
collaborativeEditing(
@ -894,6 +891,8 @@ class CollaborativeBuffer(
self,
ServerConfirmationTimeout
)
val cap = CapabilityRegistration(CanEdit(bufferPath))
replyTo ! OpenFileResponse(Right(OpenFileResult(buffer, Some(cap))))
context.become(
waitingOnServerConfirmation(
requestId,