When a message is received and automatic peek lock renewal is enabled, an async task is scheduled in the background to take care of the peek lock renewal.
I think it would be more robust to have a ConcurrentDictionary<string, PeekLockRenewer> which is checked every few seconds, and then PeekLockRenewer could take care of the logic pertaining to peek lock renewal.
This will also be a good time to add some kind of sensible retry mechanism around the renewal.
When a message is received and automatic peek lock renewal is enabled, an async task is scheduled in the background to take care of the peek lock renewal.
I think it would be more robust to have a
ConcurrentDictionary<string, PeekLockRenewer>
which is checked every few seconds, and thenPeekLockRenewer
could take care of the logic pertaining to peek lock renewal.This will also be a good time to add some kind of sensible retry mechanism around the renewal.