Hi!
We have an API that exposes signals/queries towards runnning workflows. This is implemented by using the ‘@temporalio/client’ library.
In the first iteration, we set up a connection to the temporal server on the start of the API server and reused this connection for every request. This lead to the API becoming unresponsive after some time. I assume that the reason is that one connection isn’t meant to last this long (days or weeks in our case, depending on how often we deploy our API).
I’m currently in the process of implementing a connection pool for the temporal connections, but that brings with it a lot of complexity and I’d rather have a simple solution. The simplest solution I can think of is to create a new connection for every request and close the connection after every request, but that bloats the code and makes every request slower.
What is the recommended way to deal with this?