mirror of
https://github.com/urbit/shrub.git
synced 2024-11-30 22:15:47 +03:00
Merge pull request #6595 from urbit/jb/stir-ames-rift
ames: add %rift to %stir
This commit is contained in:
commit
58aed9ccfa
@ -1755,41 +1755,56 @@
|
|||||||
++ on-stir
|
++ on-stir
|
||||||
|= arg=@t
|
|= arg=@t
|
||||||
^+ event-core
|
^+ event-core
|
||||||
=/ want=(set [@da ^duct])
|
|^ ?+ arg do-stir
|
||||||
%- ~(rep by peers.ames-state)
|
%rift do-rift
|
||||||
|= [[who=ship s=ship-state] acc=(set [@da ^duct])]
|
==
|
||||||
?. ?=(%known -.s) acc
|
|
||||||
%- ~(rep by snd.+.s)
|
|
||||||
|= [[b=bone m=message-pump-state] acc=_acc]
|
|
||||||
=* tim next-wake.packet-pump-state.m
|
|
||||||
?~ tim acc
|
|
||||||
%- ~(put in acc)
|
|
||||||
[u.tim `^duct`~[ames+(make-pump-timer-wire who b) /ames]]
|
|
||||||
=. want
|
|
||||||
(~(put in want) (add now ~d1) ~[/ames/recork /ames])
|
|
||||||
::
|
::
|
||||||
=/ have
|
++ do-rift
|
||||||
%- ~(gas in *(set [@da ^duct]))
|
=/ =rift
|
||||||
=/ tim
|
=- ~|(%no-rift (,@ q.q:(need (need -))))
|
||||||
;; (list [@da ^duct])
|
(rof ~ %j `beam`[[our %rift %da now] /(scot %p our)])
|
||||||
=< q.q %- need %- need
|
?: =(rift rift.ames-state)
|
||||||
(rof ~ %bx [[our %$ da+now] /debug/timers])
|
event-core
|
||||||
(skim tim |=([@da hen=^duct] ?=([[%ames ?(%pump %recork) *] *] hen)))
|
~& "ames: fixing rift from {<rift.ames-state>} to {<rift>}"
|
||||||
|
event-core(ames-state ames-state(rift rift))
|
||||||
::
|
::
|
||||||
:: set timers for flows that should have one set but don't
|
++ do-stir
|
||||||
::
|
=/ want=(set [@da ^duct])
|
||||||
=. event-core
|
%- ~(rep by peers.ames-state)
|
||||||
%- ~(rep in (~(dif in want) have))
|
|= [[who=ship s=ship-state] acc=(set [@da ^duct])]
|
||||||
|
?. ?=(%known -.s) acc
|
||||||
|
%- ~(rep by snd.+.s)
|
||||||
|
|= [[b=bone m=message-pump-state] acc=_acc]
|
||||||
|
=* tim next-wake.packet-pump-state.m
|
||||||
|
?~ tim acc
|
||||||
|
%- ~(put in acc)
|
||||||
|
[u.tim `^duct`~[ames+(make-pump-timer-wire who b) /ames]]
|
||||||
|
=. want
|
||||||
|
(~(put in want) (add now ~d1) ~[/ames/recork /ames])
|
||||||
|
::
|
||||||
|
=/ have
|
||||||
|
%- ~(gas in *(set [@da ^duct]))
|
||||||
|
=/ tim
|
||||||
|
;; (list [@da ^duct])
|
||||||
|
=< q.q %- need %- need
|
||||||
|
(rof ~ %bx [[our %$ da+now] /debug/timers])
|
||||||
|
(skim tim |=([@da hen=^duct] ?=([[%ames ?(%pump %recork) *] *] hen)))
|
||||||
|
::
|
||||||
|
:: set timers for flows that should have one set but don't
|
||||||
|
::
|
||||||
|
=. event-core
|
||||||
|
%- ~(rep in (~(dif in want) have))
|
||||||
|
|= [[wen=@da hen=^duct] this=_event-core]
|
||||||
|
?> ?=([^ *] hen)
|
||||||
|
(emit:this ~[/ames] %pass t.i.hen %b %wait wen)
|
||||||
|
::
|
||||||
|
:: cancel timers for flows that have one set but shouldn't
|
||||||
|
::
|
||||||
|
%- ~(rep in (~(dif in have) want))
|
||||||
|= [[wen=@da hen=^duct] this=_event-core]
|
|= [[wen=@da hen=^duct] this=_event-core]
|
||||||
?> ?=([^ *] hen)
|
?> ?=([^ *] hen)
|
||||||
(emit:this ~[/ames] %pass t.i.hen %b %wait wen)
|
(emit:this t.hen %pass t.i.hen %b %rest wen)
|
||||||
::
|
--
|
||||||
:: cancel timers for flows that have one set but shouldn't
|
|
||||||
::
|
|
||||||
%- ~(rep in (~(dif in have) want))
|
|
||||||
|= [[wen=@da hen=^duct] this=_event-core]
|
|
||||||
?> ?=([^ *] hen)
|
|
||||||
(emit:this t.hen %pass t.i.hen %b %rest wen)
|
|
||||||
:: +on-crud: handle event failure; print to dill
|
:: +on-crud: handle event failure; print to dill
|
||||||
::
|
::
|
||||||
++ on-crud
|
++ on-crud
|
||||||
|
Loading…
Reference in New Issue
Block a user