[Haskell-cafe] Running an action periodically
Moritz Schulte
mtesseract at silverratio.net
Sat Nov 25 22:53:50 UTC 2017
Hi Erèbe,
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
package):
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.
Best,
Moritz
More information about the Haskell-Cafe
mailing list