I am looking how to achieve what https://docs.python.org/3/library/asyncio-task.html#timeouts gives me, but in hack. I just want to timeout my async call in 30 minutes.
timeout for async calles in Hack
74 views Asked by Michał Piotr Stankiewicz At
2
In the HSL there is an undocumented but long-standing
Conditionclass that allows async blocks to signal each other.(
Conditionitself wraps the internalConditionWaitHandleasync primitive which has been around since the dawn of Hack async.)You can implement a timeout by having the work and a timeout block race to signal a
Condition:If you use
Conditions more widely just be aware that they can't be signalled twice and will raiseHH\InvariantExceptionto the loser of any races to signal them. Here those exceptions are confined to the async block wrappers intimeout().