Merge pull request #3799 from urbit/m/silent-subs

eyre: ignore facts directly after clog
This commit is contained in:
fang 2020-10-26 18:54:57 +01:00 committed by GitHub
commit ca3872fba4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 28 additions and 2 deletions

View File

@ -1500,6 +1500,14 @@
?~ channel
:_ state :_ ~
[duct %pass /flog %d %flog %crud %eyre-no-channel >id=channel-id< ~]
:: it's possible that this is a fact emitted directly alongside a fact
:: that triggered a clog & closed the subscription. in that case, just
:: drop the fact.
::
?: ?& ?=(%fact -.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.

View File

@ -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
@ -1922,7 +1922,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
::