oto icon indicating copy to clipboard operation
oto copied to clipboard

How to properly implement retry

Open whereswaldon opened this issue 3 years ago • 3 comments

Hi there! Thanks for such an awesome library. :D

I have an application that was just bitten by this panic. I'd like to implement the missing retry logic, but I'm not really sure that I understand the approach that I should take in doing so. Do you have any guidance about how I should approach adding this feature?

whereswaldon avatar May 06 '22 13:05 whereswaldon

Hi. Unfortunately there is no good way to retry this so far. Is the issue reproducible?

hajimehoshi avatar May 06 '22 16:05 hajimehoshi

Not currently. It has only happened once, but it crashed the entire application. Given that this panic originates on a goroutine that isn't started by application code directly, it's difficult to recover from, and it isn't clear if oto can still be used after recovering.

I will keep an eye out for it happening again and try to narrow down the cause. In the meantime though, is there anything that can be done to contain this failure so that the panic doesn't bring down the entire app? We are specifically hitting this case that is marked TODO, though the panic is a little later.

whereswaldon avatar May 06 '22 16:05 whereswaldon

Yeah, as the TODO says, we should keep an error instead of panicking. However, as I am not so familiar with the audio API, I am not sure if we really can recover from this state or not. I'd like to know when this error happens. Thank you for investigating!

hajimehoshi avatar May 06 '22 16:05 hajimehoshi