ames: refactor %stir, %rest stale/wrong timers

This commit is contained in:
Joe Bryan 2022-08-22 18:25:49 -04:00
parent a04d564269
commit 9439841ce8

View File

@ -1475,44 +1475,40 @@
:: ::
++ on-stir ++ on-stir
|= arg=@t |= arg=@t
=/ states=(list [ship peer-state]) ^+ event-core
%+ murn ~(tap by peers.ames-state) =/ want=(set [@da ^duct])
|= [=ship =ship-state] %- ~(rep by peers.ames-state)
^- (unit [^ship peer-state]) |= [[who=ship s=ship-state] acc=(set [@da ^duct])]
?. ?=(%known -.ship-state) ?. ?=(%known -.s) acc
~ %- ~(rep by snd.+.s)
`[ship +.ship-state] |= [[b=bone m=message-pump-state] acc=_acc]
=/ snds=(list (list [ship bone message-pump-state])) =* tim next-wake.packet-pump-state.m
%+ turn states ?~ tim acc
|= [=ship peer-state] %- ~(put in acc)
%+ turn ~(tap by snd) [u.tim `^duct`~[ames+(make-pump-timer-wire who b) /ames]]
|= [=bone =message-pump-state] ::
[ship bone message-pump-state] =/ have
=/ next-wakes %- ~(gas in *(set [@da ^duct]))
%+ turn `(list [ship bone message-pump-state])`(zing snds) =/ tim
|= [=ship =bone message-pump-state] ;; (list [@da ^duct])
[ship bone next-wake.packet-pump-state] =< q.q %- need %- need
=/ next-real-wakes=(list [=ship =bone =@da]) (rof ~ %bx [[our %$ da+now] /debug/timers])
%+ murn next-wakes (skim tim |=([@da hen=^duct] ?=([[%ames %pump *] *] hen)))
|= [=ship =bone tym=(unit @da)] ::
^- (unit [^ship ^bone @da]) :: %wait on missing flows
?~(tym ~ `[ship bone u.tym]) ::
=/ timers =. event-core
%- silt %- ~(rep in (~(dif in want) have))
;; (list [@da ^duct]) |= [[wen=@da hen=^duct] this=_event-core]
=< q.q %- need %- need ?> ?=([^ *] hen)
(rof ~ %bx [[our %$ da+now] /debug/timers]) (emit:this ~[/ames] %pass t.i.hen %b %wait wen)
=/ to-stir ::
%+ skip next-real-wakes :: %rest on this bullshit
|= [=ship =bone =@da] ::
(~(has in timers) [da `^duct`~[a+(make-pump-timer-wire ship bone) /ames]]) %- ~(rep in (~(dif in have) want))
~& [%stirring to-stir] |= [[wen=@da hen=^duct] this=_event-core]
|- ^+ event-core ?> ?=([^ *] hen)
?~ to-stir (emit:this t.hen %pass t.i.hen %b %rest wen)
event-core
=/ =wire (make-pump-timer-wire [ship bone]:i.to-stir)
=. event-core (emit duct %pass wire %b %wait da.i.to-stir)
$(to-stir t.to-stir)
:: +on-crud: handle event failure; print to dill :: +on-crud: handle event failure; print to dill
:: ::
++ on-crud ++ on-crud