fetch
fetch copied to clipboard
Make possible to define timeouts on smaller parts of Fetch and handle timeouts (or other errors)
We can define timeout on entire Fetch after run with cats effect, but I can't find how to define timeout on 'sub' Fetch and handle it with 'default' value. Something like:
(
fetchUser,
fetchPost,
fetchComments.withTimeout(5.secs).handleError(List.empty)
).mapN { (user, post, comments) =>
EntirePost(user, post, comments)
}
So if fetchComments is too long we can cancel fetching it and return partly constructed structure.
I also need this sort of functionality! I'm willing to submit PRs, just need guidance!