Michael Friend

02/24/2020, 6:33 PM
I want to be able to attach a resettable timeout on a job where basically I give a timeout and a channel and whenever the channel is sent a value then the timeout is reset. Is there a common practice for something like this? I was thinking of writing an extension function on Job but im not sure how i wanna approach it.

Evan R.

02/25/2020, 3:52 PM
I’ve done this in the past with a
on a channel and a timeout. Here’s a sample usage in my code: Basically if the channel receives a value first the select immediately exits and returns the value from the channel, but if the timeout occurs first I just exit with the default