Merge branch 'master' into release/next-userspace

This commit is contained in:
Matilde Park 2020-11-11 00:15:47 -05:00
commit 468d794cbc
3 changed files with 58 additions and 8 deletions

View File

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:b5d3225b222544eae6f78d18a4a2343ff4c746fbcb72914760b79598ff90813d
size 6278785
oid sha256:eb4508c64074807d1b9d4d5f37c0a20e5e8dd26b8b3029da77650ff1ebfb257a
size 6272789

View File

@ -1500,6 +1500,16 @@
?~ channel
:_ state :_ ~
[duct %pass /flog %d %flog %crud %eyre-no-channel >id=channel-id< ~]
:: it's possible that this is a sign emitted directly alongside a fact
:: that triggered a clog & closed the subscription. in that case, just
:: drop the sign.
:: poke-acks are not paired with subscriptions, so we can process them
:: regardless.
::
?: ?& !?=(%poke-ack -.sign)
!(~(has by subscriptions.u.channel) request-id)
==
[~ state]
:: attempt to convert the sign to json.
:: if conversion succeeds, we *can* send it. if the client is actually
:: connected, we *will* send it immediately.
@ -1535,10 +1545,10 @@
:: update channel's unacked counts, find out if clogged
::
=^ clogged unacked.u.channel
:: poke-acks are one-offs, don't apply clog logic to them.
:: only apply clog logic to facts.
:: and of course don't count events we can't send as unacked.
::
?: ?| ?=(%poke-ack -.sign)
?: ?| !?=(%fact -.sign)
?=(~ json)
==
[| unacked.u.channel]
@ -1555,6 +1565,10 @@
=* kicking |(clogged ?=(~ json))
=? moves kicking
:_ moves
::NOTE this shouldn't crash because we
:: - never fail to serialize subscriptionless signs (%poke-ack),
:: - only clog on %facts, which have a subscription associated,
:: - and already checked whether we still have that subscription.
=+ (~(got by subscriptions.u.channel) request-id)
:^ duct %pass
(subscription-wire channel-id request-id ship app)

View File

@ -1853,7 +1853,7 @@
==
:: user gets sent multiple subscription results
::
=/ max=@ud (dec clog-threshold:eyre-gate)
=/ max=@ud clog-threshold:eyre-gate
=/ cur=@ud 0
|- =* loop-fact $
?. =(cur max)
@ -1875,7 +1875,7 @@
loop-fact(cur +(cur))
:: the next subscription result should trigger a clog
::
=^ results eyre-gate
=^ results1 eyre-gate
%: eyre-take
eyre-gate
now
@ -1889,13 +1889,31 @@
==
^= moves
:~ :* duct=~[/http-get-open]
%give
%response
%continue
:- ~
%- as-octt:mimes:html
"""
id: {((d-co:co 1) +(clog-threshold:eyre-gate))}
data: \{"json":[1],"id":1,"response":"diff"}
"""
complete=%.n
==
:* duct=~[/http-put-request] %pass
/channel/subscription/'0123456789abcdef'/'1'/~nul/two
%g %deal [~nul ~nul] %two %leave ~
==
:* duct=~[/http-get-open]
%give
%response
%continue
:- ~
%- as-octt:mimes:html
"""
id: {((d-co:co 1) +(clog-threshold:eyre-gate))}
id: {((d-co:co 1) (add 2 clog-threshold:eyre-gate))}
data: \{"id":1,"response":"quit"}
@ -1922,7 +1940,25 @@
==
==
==
results
:: subsequent subscription updates, which might have gotten sent out during
:: the same event in which a clog triggered, should be silently ignored
::
=^ results2 eyre-gate
%: eyre-take
eyre-gate
now
scry=scry-provides-code
^= take-args
:* wire=/channel/subscription/'0123456789abcdef'/'1'/~nul/two
duct=~[/http-put-request]
^- (hypo sign:eyre-gate)
:- *type
[%g %unto %fact %json !>(`json`[%a [%n '1'] ~])]
==
^= moves
~
==
(weld results1 results2)
::
++ test-born-sends-pending-cancels
::