Azure / azure-remote-rendering

SDK and samples for Azure Remote Rendering
MIT License
107 stars 39 forks source link

Auto-Renew logic doesn't work correctly #33

Closed WikkidEdd closed 3 years ago

WikkidEdd commented 3 years ago

Describe the problem

The logic for determining when the client should auto-renew the session assumes that the session started when the app first sees the session status change to Ready. The start time is then used to calculate the expiration time, which it uses to work out when the session needs to be renewed.

The problem arises when the session was started sometime before the client connects to it. e.g Session is started at 10:00 with a least of 20 mins (expiring at 10:20) Client connects at 10:10 the client thinks that the expiration time is 10:30 and wouldn't attempt to renew it until 10:25 at which point the session will have already expired.

The current code for setting the start time looks like this:

_startTime = DateTime.UtcNow;

where as the elapsed time of the session need to be taken in to account like this:

_startTime = DateTime.UtcNow - TimeSpan.FromMinutes(properties.ElapsedTimeInMinutes);

stefanhessel commented 3 years ago

Hi @WikkidEdd! Thank you for your detailed feedback! We will look into it and let you know, when the fix is available.

stefanhessel commented 3 years ago

I added and tested your suggestion and it's now scheduled to be available with our next release. Thanks again for your contribution!

stefanhessel commented 3 years ago

The fix is part of Release 1.0.7. Thanks again!