Call timeout in Remote Plugin

Hi,
is implemented or is possible to configure a timeout in RPC calls? I’m using my plugin in a quite “unreliable” environment where the server is on K8s and can be rebalanced at any time dropping the connections.
If no timeout is configured this could create dangling connection/resources and in case of blocking call thread locking, so this is my question. On my plugin side I added a timeout in the lock, so at least things should unlock eventually.

Regards,
Mirko

Hi!

Consider just wrapping a call into the `withTimeoutOrNull` from the coroutines library - the RPC framework itself does not bring a shortcut for it

Yes, I did something similar, also because in some part of the code I need to use sync call (for example as loader side of cache and memoized object), so I convert a Deferable to a Future and get with a timeout. Not proud of it, but I try to use it as last resort.

Just to clarify:

  • awaiting a deferred returned from the backend and awaiting the RPC call itslelf to be executed are different things
  • if the network is unstable, or the backend is still starting at the moment the frontend invokes RPC, the limited waiting time might be useful. Under the hood we do have a 60s timeout for it as well, afterwards an RpcException will be thrown on the frontend side
  • if the RPC call succeeded and returned a deferred instance, you are free to await it as long as the waiting does not block EDT. Ideally instead of blocking the background thread, I’d rather use a reactive style and change the frontend state when the deferred gets completed :wink: