mirror of
https://github.com/enso-org/enso.git
synced 2024-11-29 17:22:57 +03:00
Ensure clients get write capability (#10872)
When Ydoc requests to open file and encounters a timeout, it will attempt to retry the request. At least that's the behaviour since #10787. Unfortunately, the write lock on the file might be already held and identified by the client id and actor reference. The latter is always determined by the request and therefore spurious. The same client should always be given the same capability, even on retries.
This commit is contained in:
parent
7653280e33
commit
6b0194c98b
@ -914,10 +914,12 @@ class CollaborativeBuffer(
|
||||
autoSave: Map[ClientId, (ContentVersion, Cancellable)]
|
||||
): Unit = {
|
||||
val writeCapability =
|
||||
if (lockHolder.isEmpty)
|
||||
Some(CapabilityRegistration(CanEdit(bufferPath)))
|
||||
else
|
||||
lockHolder match {
|
||||
case Some(session) if session.clientId != rpcSession.clientId =>
|
||||
None
|
||||
case _ =>
|
||||
Some(CapabilityRegistration(CanEdit(bufferPath)))
|
||||
}
|
||||
sender() ! OpenFileResponse(Right(OpenFileResult(buffer, writeCapability)))
|
||||
context.become(
|
||||
collaborativeEditing(
|
||||
|
Loading…
Reference in New Issue
Block a user