We perform client.Close() to close all connections when the dapr client has an exception to interact with the target service.
I have elevated this dapr client to the functionframeworks pkg, which makes it a global variable that can be reused and will only be recreated if the function throws an exception.
In addition, the dapr client created with NewClient() will remain in the the client connection is closing state, even if the target service is restored.
We perform
client.Close()
to close all connections when the dapr client has an exception to interact with the target service.I have elevated this dapr client to the functionframeworks pkg, which makes it a global variable that can be reused and will only be recreated if the function throws an exception.
In addition, the dapr client created with
NewClient()
will remain in thethe client connection is closing
state, even if the target service is restored.Instead, the dapr client created with
NewClientWithPort()
will be restored as the peer service is restored.Signed-off-by: laminar fangtian@kubesphere.io