@@ -58,10 +58,9 @@
58-- data stream will be checked first. No blocking will occur if the chosen
58-- data stream will be checked first. No blocking will occur if the chosen
59-- (prioritised) source is devoid of input messages, instead the agent handling
59-- (prioritised) source is devoid of input messages, instead the agent handling
60-- code will revert to switching between the alternatives in /round-robin/ as
60-- code will revert to switching between the alternatives in /round-robin/ as
61−-- usual. This switching (and prioritisation) will take place a limited number
61+-- usual. If messages exist in one or more channels, they will be consumed as
62−-- of times, after which - in order to avoid over-utilising system
62+-- soon as they're available, priority is effectively a hint about which
63−-- resources - the agent will revert to blocking on the event bus (and ignoring
63+-- channel to consume from, should messages be available in both.
66-- Prioritisation then, is a /hint/ about the preference of data source from
65-- Prioritisation then, is a /hint/ about the preference of data source from
67-- which the next input should be chosen. No guarantee can be made that the
66-- which the next input should be chosen. No guarantee can be made that the
@@ -534,17 +533,7 @@ mxAgentWithFinalize mxId initState handlers dtor = do
534 , matchSTM (readTChan chan) return]
533 , matchSTM (readTChan chan) return]
535 InputChan -> [ matchSTM (readTChan chan) return
534 InputChan -> [ matchSTM (readTChan chan) return
536 , matchAny return]
535 , matchAny return]
537− in getNextInput' matches 0
536+ in receiveWait matches
539− getNextInput' ms n = do
540− mIn <- receiveTimeout n ms
542− Nothing -> tryNextInput ms n
543− Just msg -> return msg
546− | n > 0 && n < 2000 = getNextInput' ms $ n * 2
547− | otherwise = getNextInput' ms 100
549 runAgentFinalizer :: MxAgent s () -> MxAgentState s -> Process ()
538 runAgentFinalizer :: MxAgent s () -> MxAgentState s -> Process ()
550 runAgentFinalizer f s = ST.runStateT (unAgent f) s >>= return . fst
539 runAgentFinalizer f s = ST.runStateT (unAgent f) s >>= return . fst