eyre: send warp to warm %c cache for any mark that gets used

This commit is contained in:
Logan Allen 2021-05-19 15:40:32 -05:00
parent e1bf7e1843
commit 054806b307

View File

@ -30,6 +30,9 @@
$% [%rest p=@da] $% [%rest p=@da]
[%wait p=@da] [%wait p=@da]
== == == ==
$: %c
$>(%warp task:clay)
==
:: %d: to dill :: %d: to dill
:: ::
$: %d $: %d
@ -1232,8 +1235,8 @@
:: since conversion failure also gets caught during first receive. :: since conversion failure also gets caught during first receive.
:: we can't do anything about this, so consider it unsupported. :: we can't do anything about this, so consider it unsupported.
?~ sign=(channel-event-to-sign channel-event) $ ?~ sign=(channel-event-to-sign channel-event) $
?~ json=(sign-to-json request-id u.sign) $ ?~ json-with-moves=(sign-to-json request-id u.sign) $
$(events [(event-json-to-wall id u.json) events]) $(events [(event-json-to-wall id p.u.json-with-moves) events])
:: send the start event to the client :: send the start event to the client
:: ::
=^ http-moves state =^ http-moves state
@ -1499,8 +1502,13 @@
:: if conversion succeeds, we *can* send it. if the client is actually :: if conversion succeeds, we *can* send it. if the client is actually
:: connected, we *will* send it immediately. :: connected, we *will* send it immediately.
:: ::
=/ json=(unit json) =/ json-with-moves=(unit (pair json (list move)))
(sign-to-json request-id sign) (sign-to-json request-id sign)
=/ json=(unit json)
?~ json-with-moves ~
`p.u.json-with-moves
=? moves ?=(^ json-with-moves)
(weld moves q.u.json-with-moves)
=* sending &(?=([%| *] state.u.channel) ?=(^ json)) =* sending &(?=([%| *] state.u.channel) ?=(^ json))
:: ::
=/ next-id next-id.u.channel =/ next-id next-id.u.channel
@ -1578,7 +1586,7 @@
^= data ^= data
%- wall-to-octs %- wall-to-octs
%+ event-json-to-wall next-id %+ event-json-to-wall next-id
(need (sign-to-json request-id %kick ~)) p:(need (sign-to-json request-id %kick ~))
:: ::
complete=%.n complete=%.n
== ==
@ -1620,12 +1628,12 @@
:: ::
++ sign-to-json ++ sign-to-json
|= [request-id=@ud =sign:agent:gall] |= [request-id=@ud =sign:agent:gall]
^- (unit json) ^- (unit (pair json (list move)))
:: for facts, we try to convert the result to json :: for facts, we try to convert the result to json
:: ::
=/ jsyn=(unit sign:agent:gall) =/ jsyn=(pair (unit mark) (unit sign:agent:gall))
?. ?=(%fact -.sign) `sign ?. ?=(%fact -.sign) ``sign
?: ?=(%json p.cage.sign) `sign ?: ?=(%json p.cage.sign) ``sign
:: find and use tube from fact mark to json :: find and use tube from fact mark to json
:: ::
=* have=mark p.cage.sign =* have=mark p.cage.sign
@ -1636,16 +1644,20 @@
?. ?=([~ ~ *] tuc) ~ ?. ?=([~ ~ *] tuc) ~
`!<(tube:clay q.u.u.tuc) `!<(tube:clay q.u.u.tuc)
?~ tube ?~ tube
((slog leaf+"eyre: no tube {desc}" ~) ~) ((slog leaf+"eyre: no tube {desc}" ~) [~ ~])
:: ::
=/ res (mule |.((u.tube q.cage.sign))) =/ res (mule |.((u.tube q.cage.sign)))
?: ?=(%& -.res) ?: ?=(%& -.res)
`[%fact %json p.res] [`have `[%fact %json p.res]]
((slog leaf+"eyre: failed tube {desc}" ~) ~) ((slog leaf+"eyre: failed tube {desc}" ~) [~ ~])
:: ::
?~ jsyn ~ ?~ q.jsyn ~
%- some %- some
=* sign u.jsyn :_ ?~ p.jsyn ~
:_ ~
:^ duct %pass /pass/(scot %ud request-id)
[%c %warp our %home `[%sing %c da+now /[u.p.jsyn]/json]]
=* sign u.q.jsyn
=, enjs:format =, enjs:format
%- pairs %- pairs
^- (list [@t json]) ^- (list [@t json])