gall: in +ap-doff, process oldest subs first
Start by killing subscription nonce 0, then work our way up instead of
down. We enhance the printf with a "total nonces" indicator so we can
still easily see the progress being made.
=+ [wyr dok]=i.subs
?: =(ship `ship.dok)
$(subs t.subs)
- =/ let (~(got by boar.yoke) wyr dok)
- |- ^+ ap-core
- ~> %slog.[0 leaf+"gall: +ap-doff {<[agent-name wyr dok let]>}"]
- =. ap-core (ap-pass [(scot %ud let) wyr] %agent dok %leave ~)
- ?. =(0 let)
- $(let (dec let))
:: kill old-style subscription wire with no nonce
::
=. ap-core (ap-pass wyr %agent dok %leave ~)
+ :: kill new-style subscriptions at every previously-known nonce
+ ::
+ =/ let (~(got by boar.yoke) wyr dok)
+ =/ non 0
+ |- ^+ ap-core
+ %- =- (slog leaf+- ~)
+ "gall: +ap-doff {<[agent-name wyr dok]>} {<non>}/{<,.let>}"
+ =. ap-core (ap-pass [(scot %ud non) wyr] %agent dok %leave ~)
+ ?: (lth non let)
+ $(non +(non))
+ :: do the %kick last: leaves must be processed first
+ ::
=. ap-core (ap-pass wyr %huck dok %b %huck [%gall %unto %kick ~])
^$(subs t.subs)
:: +ap-mule: run virtualized with intercepted scry, preserving type
