Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FEATURE] Provide heartbeat feedback possibility from factory for complementing timeouts #325

Open
zorgoz opened this issue Oct 29, 2024 · 1 comment

Comments

@zorgoz
Copy link

zorgoz commented Oct 29, 2024

Problem

Some factories take really long time to run. Like fetching all users from a tenant from AzureAD. That's why they need to be cached. GraphAPI provides paginated fetch possibility only - that makes sense. Hence the data is produced in chunks. Each chunk can time out on its own, but the complete batch can take much-much longer. Setting a long timeout for the whole factory is not resilient enough.

Solution

If there is a way to signal from the producer that the factory is still working properly, it could reset the timeout timer.

Proposal

An overload for each core method that takes a factory, where the factory is
Fun<IHeartbeatSignal, T> and Fun<IHeartbeatSignal, CancellationToken, Task<T>> respectively

public interface IHeartbeatSignal
{
       void Signal();
}

The factory should call this method to reset the timeout counter. If the signal does not arrive within the timeout period, the factory is considered to be in timeout and handled accordingly based on failsafe setup and async version.

@jodydonetti
Copy link
Collaborator

Hi @zorgoz , this is in fact an interesting idea!
Not straightforward to implement, but still: let me think about it (including potential ramifications, edge cases and whatnot), will get back to you.
Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants