canonical / pebble

Take control of your internal daemons!
GNU General Public License v3.0
137 stars 52 forks source link

fix(client): make retry loop stop immediately when context is cancelled #386

Closed benhoyt closed 4 months ago

benhoyt commented 4 months ago

I noticed that pebble notices --timeout=60s was taking about 5s to exit after you pressed Ctrl-C, when we were listening to SIGINT correctly and cancelling the context. Turns out defaultRequester.retry was only looking at the timeout channel, not the ctx.Done() one.

Writing this afresh we'd probably just use a context for the timeout as well as for cancellation, but do this minimal fix for now.