Merge pull request #6322 from urbit/i/6065/clean-flows

ames: update logs for |close-flows
This commit is contained in:
Ted Blackman 2023-02-14 12:56:52 -05:00 committed by GitHub
commit b271d5e3c3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 31 additions and 14 deletions

View File

@ -1,4 +1,4 @@
:: |close-flows: corks all stale ames flows
:: Deletes all stale ames flows from failed (re) subscriptions
::
:: It runs in dry mode by default, printing the flows that can be closed.
:: To actually close the flows, run with |close-flows, =dry |
@ -6,4 +6,4 @@
:- %say
|= [^ arg=~ dry=?]
::
[%helm-kroc dry]
[%helm-ames-kroc dry]

View File

@ -24,7 +24,7 @@
~? &(=(%3 veb) (gth (lent v) 1))
"#{<(dec (lent v))>} stale resubs on {<k>}"
?. (gth (lent v) 1) num
(add (lent v) num)
(add (dec (lent v)) num)
--
::
:- %say
@ -49,8 +49,8 @@
:- %tang %- flop
%+ weld
:~ leaf+"#{<~(wyt in naks)>} flows from %nacking %watches"
leaf+"#{<backward>} backward flows with >10 retries"
leaf+"#{<forward>} forward flows with >10 retries"
leaf+"#{<backward>} live backward flows with (keep retrying)"
leaf+"#{<forward>} live forward flows with (keep retrying)"
leaf+"#{<(resubs subs veb)>} stale resubscriptions"
==
?. =(%21 veb) ~
@ -76,7 +76,10 @@
::
++ stale
%+ roll ~(tap by snd.peer-state)
|= [[=bone message-pump-state:ames] subs=_subs pags=_p backward=_b forward=_f]
|= $: [=bone message-pump-state:ames]
subs=_subs pags=_p
backward=_b forward=_f
==
=, packet-pump-state
:- ?~ duct=(~(get by by-bone.ossuary.peer-state) bone) subs
?. ?=([* [%gall %use sub=@ @ %out @ @ nonce=@ pub=@ *] *] u.duct)
@ -90,7 +93,10 @@
::
(weld (scag 7 wire) (slag 8 wire))
%+ roll ~(tap in live)
|= [[* [packet-state:ames *]] pags=_pags out=[b=_backward f=_forward]]
|= $: [[msg=@ frag=@] [packet-state:ames *]]
pags=_pags
out=[b=_backward f=_forward]
==
::
:: only forward flows
::
@ -104,7 +110,9 @@
::
~? &(=(%2 veb) (gth retries 10))
=+ arrow=?:(=(0 (end 0 bone)) "<-" "->")
"{arrow} ({(cite:title ship)}) bone #{<bone>}, retries: #{<retries>}"
=+ closing=(~(has in closing.peer-state) bone)
%+ weld "{arrow} ({(cite:title ship)}) bone=#{<bone>} "
"closing={<closing>} msg=#{<msg>} frag=#{<frag>} #{<retries>}"
:- pags
=? out (gth retries 10)
?: =(0 (end 0 bone))

View File

@ -245,9 +245,9 @@
|= ~ =< abet
(emit %pass /helm %arvo %a %stir '')
::
++ poke-kroc
++ poke-ames-kroc
|= dry=? =< abet
(emit [%pass /helm/kroc %arvo %a %kroc dry])
(emit %pass /helm %arvo %a %kroc dry)
::
++ poke-knob
|= [error-tag=@tas level=?(%hush %soft %loud)] =< abet
@ -284,7 +284,7 @@
%helm-ames-sift =;(f (f !<(_+<.f vase)) poke-ames-sift)
%helm-ames-verb =;(f (f !<(_+<.f vase)) poke-ames-verb)
%helm-ames-wake =;(f (f !<(_+<.f vase)) poke-ames-wake)
%helm-kroc =;(f (f !<(_+<.f vase)) poke-kroc)
%helm-ames-kroc =;(f (f !<(_+<.f vase)) poke-ames-kroc)
%helm-atom =;(f (f !<(_+<.f vase)) poke-atom)
%helm-automass =;(f (f !<(_+<.f vase)) poke-automass)
%helm-cancel-automass =;(f (f !<(_+<.f vase)) poke-cancel-automass)

View File

@ -1962,11 +1962,14 @@
=/ rcvr [ship her-life.channel]
"cork plea {<sndr rcvr bone=bone vane.plea path.plea>}"
abet:(on-memo:(make-peer-core peer-state channel) bone plea %plea)
:: +on-kroc: cork all flows from failed subscriptions
:: +on-kroc: cork all stale flows from failed subscriptions
::
++ on-kroc
|= dry=?
^+ event-core
:: no-op
::
?: & %.(event-core (slog leaf/"ames: %kroc task not ready" ~))
::
=; [corks=@ core=_event-core]
?. dry core
@ -1979,9 +1982,15 @@
=/ =peer-state:ames ?>(?=(%known -.ship-state) +.ship-state)
=/ subs=(jar path [bone sub-nonce=@])
%+ roll ~(tap by snd.peer-state)
|= [[=forward=bone *] subs=(jar path [bone sub-nonce=@])]
|= $: [=forward=bone message-pump-state:ames]
subs=(jar path [bone sub-nonce=@])
==
?: (~(has in closing.peer-state) forward-bone)
subs
%. subs
%^ trace &(dry odd.veb) ship
|.
%+ weld "stale flow bone={<forward-bone>} in closing, "
"#{<~(wyt in live:packet-pump-state)>} packets retrying"
?~ duct=(~(get by by-bone.ossuary.peer-state) forward-bone)
subs
?. ?=([* [%gall %use sub=@ @ %out @ @ nonce=@ pub=@ *] *] u.duct)