busyloop candidate

This commit is contained in:
voidlizard 2025-02-18 12:51:46 +03:00
parent e6d8489ce5
commit 2e36a9401c
1 changed files with 3 additions and 1 deletions

View File

@ -23,6 +23,8 @@ polling :: forall a m . (MonadIO m, Hashable a)
polling o listEntries action = do polling o listEntries action = do
let tsMin = toTimeSpec (TimeoutSec 0.01)
-- FIXME: might-be-concurrent -- FIXME: might-be-concurrent
pause (TimeoutNDT (waitBefore o)) pause (TimeoutNDT (waitBefore o))
@ -48,7 +50,7 @@ polling o listEntries action = do
next (HashMap.delete r mon') next (HashMap.delete r mon')
Just (Entry t _, _) | otherwise -> do Just (Entry t _, _) | otherwise -> do
pause (TimeoutTS (t - now)) pause (max (TimeoutTS tsMin) (TimeoutTS (t - now)))
next mon' next mon'
Nothing -> do Nothing -> do