gall: kill old subscriptions on %doff (still has bug)

Squashed commit of the following:

commit 1e31ab96c14e7506d5cb746d90153cb5658df6e0
Author: Ted Blackman <ted@tlon.io>
Date:   Wed Aug 10 19:08:39 2022 +0300

    ames: revert prints on bad memos

commit c47f9c6053c05da0177f0c64210a88161e8adc98
Author: Ted Blackman <ted@tlon.io>
Date:   Wed Aug 10 18:44:56 2022 +0300

    Merge fix to +ap-kill-down and use that pattern in +mo-doff.

    This doesn't seem to work properly, but I'm not sure why so far.

commit e696816b8d3ab81534de6c2910d0fd4bebcfb68a
Merge: 4edb247cd7 a5f08643ff
Author: Ted Blackman <ted@tlon.io>
Date:   Wed Aug 10 18:29:42 2022 +0300

    Merge branch 'next/arvo' into ted/doff-revival

commit 4edb247cd77ac988e5b11806d0d9b5e7cec4a39e
Author: Ted Blackman <ted@tlon.io>
Date:   Sat Aug 6 00:09:04 2022 +0300

    ames,gall: fix lopsided bitt/boar state from old doffs

commit b21ffd9cfab0987297f3ae4cd16447ed0c3a467e
Merge: 7d532afaf8 8eb8a1da29
Author: Ted Blackman <ted@tlon.io>
Date:   Fri Aug 5 17:53:15 2022 +0300

    Merge branch 'next/arvo' into ted/kill-subs

commit 7d532afaf80b773139b66d787c4a446e3d6a9a33
Author: Ted Blackman <ted@tlon.io>
Date:   Fri Aug 5 17:52:16 2022 +0300

    gall: add subscription nonce to %doff

commit f750de9aacdb19f796bff527e220df9c10e41e71
Merge: 38540658b5 aad5fa6fae
Author: Ted Blackman <ted@tlon.io>
Date:   Fri Aug 5 11:24:55 2022 +0300

    Merge branch 'next/arvo' into ted/kill-subs

commit 38540658b59d703b0fa162af4f958948b7ee2031
Author: fang <git@fang.io>
Date:   Thu Jul 28 21:10:57 2022 +0200

    gall: account for renaming of subscription state

commit c015dc8446fc02729ad492e24635c9c521f09965
Merge: 7c222e4c60 731e27d5a1
Author: Zach Alberico <git@zalberico.com>
Date:   Thu Jul 28 10:14:24 2022 -0700

    Merge branch 'next/arvo' into ted/kill-subs

commit 7c222e4c60d946042fd06d858086a883bf8a0f7b
Author: Ted Blackman <ted@tlon.io>
Date:   Thu Jul 28 14:01:00 2022 +0200

    hood: |doff generator

commit 8d00cf1bd1b304f30431614b68002827e498d97e
Author: Ted Blackman <ted@tlon.io>
Date:   Thu Jul 28 13:21:45 2022 +0200

    gall: fix compile errors

commit 6a1fd360ffc65d8c6f90e491bb21fa7799a98c31
Author: Ted Blackman <ted@tlon.io>
Date:   Thu Jul 28 13:01:16 2022 +0200

    gall: add %doff task to kill subscriptions
This commit is contained in:
Ted Blackman 2022-08-10 19:09:47 +03:00
parent a5f08643ff
commit 543efac183
4 changed files with 45 additions and 0 deletions

View File

@ -0,0 +1,5 @@
:- %say
|= $: [now=@da eny=@uvJ bec=beak]
[~ ~]
==
[%helm-doff ~]

View File

@ -260,6 +260,11 @@
=< abet
(emit %pass /helm/cors/reject %arvo %e %reject-origin origin)
::
++ poke-doff
|= ~
=< abet
(emit %pass /helm/doff %arvo %g %doff ~)
::
++ poke
|= [=mark =vase]
?> ?| ?=(%helm-hi mark)
@ -277,6 +282,7 @@
%helm-code =;(f (f !<(_+<.f vase)) poke-code)
%helm-cors-approve =;(f (f !<(_+<.f vase)) poke-cors-approve)
%helm-cors-reject =;(f (f !<(_+<.f vase)) poke-cors-reject)
%helm-doff =;(f (f !<(_+<.f vase)) poke-doff)
%helm-gall-sift =;(f (f !<(_+<.f vase)) poke-gall-sift)
%helm-gall-verb =;(f (f !<(_+<.f vase)) poke-gall-verb)
%helm-hi =;(f (f !<(_+<.f vase)) poke-hi)

View File

@ -1659,6 +1659,7 @@
[%jolt =desk =dude] :: (re)start agent
[%idle =dude] :: suspend agent
[%nuke =dude] :: delete agent
[%doff ~] :: kill subscriptions
$>(%init vane-task) :: set owner
$>(%trim vane-task) :: trim state
$>(%vega vane-task) :: report upgrade

View File

@ -429,6 +429,15 @@
=/ =case [%da now]
=/ =wire /sys/cor/[dap]/(scot %p ship)/[desk]/(scot case)
(mo-pass wire %c %warp ship desk ~ %sing %a case /app/[dap]/hoon)
:: +mo-doff: kill all outgoing subscriptions
::
++ mo-doff
^+ mo-core
=/ apps ~(tap by yokes.state)
|- ^+ mo-core
?~ apps mo-core
=/ ap-core (ap-yoke:ap:mo-core p.i.apps [~ our] q.i.apps)
$(apps t.apps, mo-core ap-abet:ap-doff:ap-core)
:: +mo-receive-core: receives an app core built by %ford.
::
:: Presuming we receive a good core, we first check to see if the agent
@ -1751,6 +1760,29 @@
::
(ap-pass (ap-nonce-wire sub-wire dock) %agent dock %leave ~)
(ap-pass sub-wire %huck dock %b %huck `sign-arvo`[%gall %unto %kick ~])
:: +ap-doff: kill all outgoing subscriptions
::
:: Also kills old subscriptions that should have been killed but
:: were not correctly removed in prerelease versions of the
:: request queue fix.
::
++ ap-doff
^+ ap-core
=/ subs ~(tap in ~(key by boat.yoke))
|- ^+ ap-core
?~ subs ap-core
=+ [wyr dok]=i.subs
=/ let (~(got by boar.yoke) wyr dok)
|- ^+ ap-core
~> %slog.[0 leaf+"gall: +ap-doff {<agent-name>} {<dok>} {<let>}"]
=. ap-core (ap-pass [(scot %ud let) wyr] %agent dok %leave ~)
=. ap-core (ap-pass wyr %huck dok %b %huck [%gall %unto %kick ~])
?. =(0 let)
$(let (dec let))
:: kill old-style subscription wire with no nonce
::
=. ap-core (ap-pass wyr %agent dok %leave ~)
^$(subs t.subs)
:: +ap-mule: run virtualized with intercepted scry, preserving type
::
:: Compare +mute and +mule. Those pass through scry, which
@ -1945,6 +1977,7 @@
%jolt mo-abet:(mo-jolt:mo-core dude.task our desk.task)
%idle mo-abet:(mo-idle:mo-core dude.task)
%nuke mo-abet:(mo-nuke:mo-core dude.task)
%doff mo-abet:mo-doff:mo-core
%spew mo-abet:(mo-spew:mo-core veb.task)
%sift mo-abet:(mo-sift:mo-core dudes.task)
%trim [~ gall-payload]