Update of action in RD with suspend RPC call

Hi,
I think I end up the the same situation, but I’m not sure how to solve it, mainly the AnAction update rely on an information wrapped in the readAction, but because of the split plugin the readAction is in the backend and the update is in the frontEnd.

Update doesn’t support suspend function calls without wrapping them in something that makes them synchronous, so now we are in different thread try to get the ReadAction lock (update is inside a RWAction). So we have my readAction, the update BGT and EDT competing for the same lock.

Any way to solve it, if my understranding is correct? Can I update the event.presentation in a coroutine hoping will propagate the locks when run in monolithic mode?

Regards,
Mirko

Hi, sorry for late answer

Calling rpc in a nonsuspendable context is discouraged. We advice to split data sync and action update this way:

  1. the backend data is published via rpc/remote topic api to the frontend once it is updated on the backend side
  2. frontend stores a mirror for the backend state which is eventually consistent with the backend
  3. frontend clients like AnAction.update() always access only the frontend mirror

clients may sometimes receive a slightly outdated state which is expected and fine