I was wondering about ideas to optimize the autorefresh feature of an UDDynamic.
My usecase
We have a dashboard which users can use to temporarily gain access to an Active Directory group (JIT). One of the widgets we show on this page reveals the current groups a user has temporary access to.
This widget shows the group name, the time left and the end time.
Right after an user requests access this widget is refreshed. Changes in group membership aren’t instantly replicated to all domain controllers, so this doesn’t show the new membership instantly in the widget.
My current solution
When I add an autorefresh with a autorefreshinterval of 1 second the timer gives a nice countdown and newly added groups are shown as soon as possible.
My problem
I see myself adding a refresh interval on more dashboards. The risk I see is that with many users having these dashboards open, the load on the system will grind PSU to a halt.
My possible solution
Since the refresh is most beneficial right after submitting the form I am thinking about staggering the refresh rate. This could be easily done with a counter which could be set at 60 after submitting the form. Every refresh the counter could be lowered by 1.
While the counter is above 0, the refresh interval would be 1. Once it reaches 0, I could set the refresh interval to 15 to slow the refresh.
Does anyone have a better way to throttle the refresh rate to slow down after time?