PowerPlatform-DataverseServiceClient icon indicating copy to clipboard operation
PowerPlatform-DataverseServiceClient copied to clipboard

Service Client is not reusing an existing connection

Open kwu022 opened this issue 3 years ago • 1 comments

It seems like every time a new ServiceClient is returning a new connection (re-login to D365), although we have passed RequireNewInstance=false in the connection string, which uses client and secret.

It doesn't happen in the old .Net SDK. Below are traces for the different queries initiated from a Function App (different sessions and different method calls).

image

kwu022 avatar Aug 19 '22 01:08 kwu022

Thanks for your report,
We will take a look at this.

MattB-msft avatar Aug 21 '22 01:08 MattB-msft

@kwu022 , we have identified a bug in this behavior that would cause this pattern fault if the previous connection was disposed. We are going to move to a newer pattern for this:

if a connection is created to an instance with use unique = false, then disposed. then the next connection contains use unique = false, will run the 'restart' behavior to connect to the instance,

if a connection is created to an instance with use unique = false, then the next connection contains use unique = false, we will reuse the settings from the first connection.

Note, this default behavior for use unique is 'true'.

MattB-msft avatar Feb 14 '23 17:02 MattB-msft