[Haskell-cafe] Running an action periodically
mtesseract at silverratio.net
Sat Nov 25 22:53:50 UTC 2017
Thanks for the suggestion.
I've only had a very quick look at the auto-update package, so please
correct me if I'm wrong. But I think there is an important difference
between auto-update and the suggested pollT (or the async-refresh
auto-update does not completely decouple the execution of the IO
action from the calling thread. I'm referring to this comment:
mkAutoUpdate :: UpdateSettings a -> IO (IO a)
Generate an action which will either read from an automatically
updated value, **or run the update action in the current thread**.
pollT and async-refresh are implemented such that the caller really
only retrieves the result of a previously executed IO action. Thus
even if the IO action might block, the caller does basically not block
(more than required for reading a TVar).
For the use case it was created for (refreshing of authentication
tokens in a micro service) it might be very important that the
required tokens are *always* guaranteed to be available already at the
time a request needs to be made.
But maybe I'm overlooking something and auto-update does indeed also
provide this functionality.
More information about the Haskell-Cafe