mirror of
https://github.com/urbit/shrub.git
synced 2024-12-19 08:32:39 +03:00
graph-push-hook: add better hints for profiling
This commit is contained in:
parent
9b4b9c5c72
commit
57f5550dbc
@ -33,6 +33,7 @@
|
|||||||
%- (agent:push-hook config)
|
%- (agent:push-hook config)
|
||||||
^- agent
|
^- agent
|
||||||
=-
|
=-
|
||||||
|
~% %graph-push-hook-agent ..scry.hook-core ~
|
||||||
=| state-one
|
=| state-one
|
||||||
=* state -
|
=* state -
|
||||||
|_ =bowl:gall
|
|_ =bowl:gall
|
||||||
@ -72,6 +73,7 @@
|
|||||||
::
|
::
|
||||||
++ on-fail on-fail:def
|
++ on-fail on-fail:def
|
||||||
++ transform-proxy-update
|
++ transform-proxy-update
|
||||||
|
~/ %transform-proxy-update
|
||||||
|= vas=vase
|
|= vas=vase
|
||||||
^- (unit vase)
|
^- (unit vase)
|
||||||
=/ =update:store !<(update:store vas)
|
=/ =update:store !<(update:store vas)
|
||||||
@ -81,23 +83,31 @@
|
|||||||
%add-nodes
|
%add-nodes
|
||||||
?. (is-allowed-add:hc rid nodes.q.update)
|
?. (is-allowed-add:hc rid nodes.q.update)
|
||||||
~
|
~
|
||||||
|
:: TODO: this scry is slow.
|
||||||
=/ mark (get-mark:gra rid)
|
=/ mark (get-mark:gra rid)
|
||||||
?~ mark `vas
|
?~ mark `vas
|
||||||
|^
|
=< $
|
||||||
=/ transform
|
~% %transform-add-nodes ..transform-proxy-update ~
|
||||||
!< $-([index:store post:store atom ?] [index:store post:store])
|
|%
|
||||||
%. !>(*indexed-post:store)
|
++ $
|
||||||
.^(tube:clay (scry:hc %cc %home /[u.mark]/transform-add-nodes))
|
^- (unit vase)
|
||||||
=/ [* result=(list [index:store node:store])]
|
:: TODO: scries are slow, we should find a way to cache this so as
|
||||||
%+ roll
|
:: not to need to fetch it continually in the hot path
|
||||||
(flatten-node-map ~(tap by nodes.q.update))
|
=/ transform
|
||||||
(transform-list transform)
|
!< $-([index:store post:store atom ?] [index:store post:store])
|
||||||
=. nodes.q.update
|
%. !>(*indexed-post:store)
|
||||||
%- ~(gas by *(map index:store node:store))
|
.^(tube:clay (scry:hc %cc %home /[u.mark]/transform-add-nodes))
|
||||||
result
|
=/ [* result=(list [index:store node:store])]
|
||||||
[~ !>(update)]
|
%+ roll
|
||||||
|
(flatten-node-map ~(tap by nodes.q.update))
|
||||||
|
(transform-list transform)
|
||||||
|
=. nodes.q.update
|
||||||
|
%- ~(gas by *(map index:store node:store))
|
||||||
|
result
|
||||||
|
[~ !>(update)]
|
||||||
::
|
::
|
||||||
++ flatten-node-map
|
++ flatten-node-map
|
||||||
|
~/ %flatten-node-map
|
||||||
|= lis=(list [index:store node:store])
|
|= lis=(list [index:store node:store])
|
||||||
^- (list [index:store node:store])
|
^- (list [index:store node:store])
|
||||||
|^
|
|^
|
||||||
@ -129,6 +139,7 @@
|
|||||||
--
|
--
|
||||||
::
|
::
|
||||||
++ transform-list
|
++ transform-list
|
||||||
|
~/ %transform-list
|
||||||
|= transform=$-([index:store post:store atom ?] [index:store post:store])
|
|= transform=$-([index:store post:store atom ?] [index:store post:store])
|
||||||
|= $: [=index:store =node:store]
|
|= $: [=index:store =node:store]
|
||||||
[indices=(set index:store) lis=(list [index:store node:store])]
|
[indices=(set index:store) lis=(list [index:store node:store])]
|
||||||
@ -172,6 +183,7 @@
|
|||||||
++ resource-for-update resource-for-update:gra
|
++ resource-for-update resource-for-update:gra
|
||||||
::
|
::
|
||||||
++ initial-watch
|
++ initial-watch
|
||||||
|
~/ %initial-watch
|
||||||
|= [=path =resource:res]
|
|= [=path =resource:res]
|
||||||
^- vase
|
^- vase
|
||||||
|^
|
|^
|
||||||
@ -211,7 +223,8 @@
|
|||||||
==
|
==
|
||||||
--
|
--
|
||||||
::
|
::
|
||||||
^| ^= hook-core
|
~% %graph-push-hook-helper ..card.hook-core ~
|
||||||
|
^= hook-core
|
||||||
|_ =bowl:gall
|
|_ =bowl:gall
|
||||||
+* grp ~(. group bowl)
|
+* grp ~(. group bowl)
|
||||||
met ~(. mdl bowl)
|
met ~(. mdl bowl)
|
||||||
@ -254,6 +267,8 @@
|
|||||||
++ get-roles-writers-variation
|
++ get-roles-writers-variation
|
||||||
|= =resource:res
|
|= =resource:res
|
||||||
^- (unit [is-admin=? writers=(set ship) vip=vip-metadata:metadata])
|
^- (unit [is-admin=? writers=(set ship) vip=vip-metadata:metadata])
|
||||||
|
:: TODO: doing three scries in a row on the hot path is slow
|
||||||
|
::
|
||||||
=/ assoc=(unit association:metadata)
|
=/ assoc=(unit association:metadata)
|
||||||
(peek-association:met %graph resource)
|
(peek-association:met %graph resource)
|
||||||
?~ assoc ~
|
?~ assoc ~
|
||||||
@ -276,6 +291,8 @@
|
|||||||
++ is-allowed-add
|
++ is-allowed-add
|
||||||
|= [=resource:res nodes=(map index:store node:store)]
|
|= [=resource:res nodes=(map index:store node:store)]
|
||||||
^- ?
|
^- ?
|
||||||
|
:: TODO: extremely slow due to scries. This takes about ~30ms per
|
||||||
|
:: %add-nodes event.
|
||||||
|^
|
|^
|
||||||
%- (bond |.(%.n))
|
%- (bond |.(%.n))
|
||||||
%+ biff (get-roles-writers-variation resource)
|
%+ biff (get-roles-writers-variation resource)
|
||||||
@ -291,6 +308,7 @@
|
|||||||
%.n
|
%.n
|
||||||
?. =(author.p.post.node src.bowl)
|
?. =(author.p.post.node src.bowl)
|
||||||
%.n
|
%.n
|
||||||
|
:: TODO: these scries are slow, find a way to persistently cache them
|
||||||
=/ =permissions:store
|
=/ =permissions:store
|
||||||
%^ add-mark resource vip
|
%^ add-mark resource vip
|
||||||
(node-to-indexed-post node)
|
(node-to-indexed-post node)
|
||||||
|
@ -26,6 +26,7 @@
|
|||||||
::
|
::
|
||||||
/- *push-hook
|
/- *push-hook
|
||||||
/+ default-agent, resource, verb, versioning, agentio
|
/+ default-agent, resource, verb, versioning, agentio
|
||||||
|
~% %push-hook-top ..part ~
|
||||||
|%
|
|%
|
||||||
+$ card card:agent:gall
|
+$ card card:agent:gall
|
||||||
::
|
::
|
||||||
@ -84,6 +85,7 @@
|
|||||||
%.n
|
%.n
|
||||||
::
|
::
|
||||||
++ push-hook
|
++ push-hook
|
||||||
|
~/ %push-hook
|
||||||
|* =config
|
|* =config
|
||||||
$_ ^|
|
$_ ^|
|
||||||
|_ bowl:gall
|
|_ bowl:gall
|
||||||
@ -175,6 +177,7 @@
|
|||||||
=* state -
|
=* state -
|
||||||
^- agent:gall
|
^- agent:gall
|
||||||
=<
|
=<
|
||||||
|
~% %push-agent-lib ..poke-hook-action ~
|
||||||
|_ =bowl:gall
|
|_ =bowl:gall
|
||||||
+* this .
|
+* this .
|
||||||
og ~(. push-hook bowl)
|
og ~(. push-hook bowl)
|
||||||
@ -267,6 +270,7 @@
|
|||||||
!>(state)
|
!>(state)
|
||||||
::
|
::
|
||||||
++ on-poke
|
++ on-poke
|
||||||
|
~/ %on-poke
|
||||||
|= [=mark =vase]
|
|= [=mark =vase]
|
||||||
^- (quip card:agent:gall agent:gall)
|
^- (quip card:agent:gall agent:gall)
|
||||||
?: =(mark %push-hook-action)
|
?: =(mark %push-hook-action)
|
||||||
@ -283,6 +287,7 @@
|
|||||||
[cards this]
|
[cards this]
|
||||||
::
|
::
|
||||||
++ on-watch
|
++ on-watch
|
||||||
|
~/ %on-watch
|
||||||
|= =path
|
|= =path
|
||||||
^- (quip card:agent:gall agent:gall)
|
^- (quip card:agent:gall agent:gall)
|
||||||
?: ?=([%version ~] path)
|
?: ?=([%version ~] path)
|
||||||
@ -320,6 +325,7 @@
|
|||||||
--
|
--
|
||||||
::
|
::
|
||||||
++ on-agent
|
++ on-agent
|
||||||
|
~/ %on-agent
|
||||||
|= [=wire =sign:agent:gall]
|
|= [=wire =sign:agent:gall]
|
||||||
^- (quip card:agent:gall agent:gall)
|
^- (quip card:agent:gall agent:gall)
|
||||||
?. ?=([%helper %push-hook @ *] wire)
|
?. ?=([%helper %push-hook @ *] wire)
|
||||||
@ -373,6 +379,7 @@
|
|||||||
[%x %min-version ~] ``version+!>(version.config)
|
[%x %min-version ~] ``version+!>(version.config)
|
||||||
==
|
==
|
||||||
--
|
--
|
||||||
|
~% %push-helper-lib ..card ~
|
||||||
|_ =bowl:gall
|
|_ =bowl:gall
|
||||||
+* og ~(. push-hook bowl)
|
+* og ~(. push-hook bowl)
|
||||||
ver ~(. versioning [bowl [update-mark version min-version]:config])
|
ver ~(. versioning [bowl [update-mark version min-version]:config])
|
||||||
@ -380,6 +387,7 @@
|
|||||||
pass pass:io
|
pass pass:io
|
||||||
::
|
::
|
||||||
++ poke-hook-action
|
++ poke-hook-action
|
||||||
|
~/ %poke-hook-action
|
||||||
|= =action
|
|= =action
|
||||||
^- (quip card:agent:gall _state)
|
^- (quip card:agent:gall _state)
|
||||||
|^
|
|^
|
||||||
@ -448,6 +456,7 @@
|
|||||||
[%pass wire %agent [our.bowl store-name.config] %watch store-path.config]
|
[%pass wire %agent [our.bowl store-name.config] %watch store-path.config]
|
||||||
::
|
::
|
||||||
++ push-updates
|
++ push-updates
|
||||||
|
~/ %push-updates
|
||||||
|= =cage
|
|= =cage
|
||||||
^- (list card:agent:gall)
|
^- (list card:agent:gall)
|
||||||
%+ roll (resource-for-update q.cage)
|
%+ roll (resource-for-update q.cage)
|
||||||
@ -484,6 +493,7 @@
|
|||||||
--
|
--
|
||||||
::
|
::
|
||||||
++ forward-update
|
++ forward-update
|
||||||
|
~/ %forward-update
|
||||||
|= =cage
|
|= =cage
|
||||||
^- (list card:agent:gall)
|
^- (list card:agent:gall)
|
||||||
=- lis
|
=- lis
|
||||||
@ -532,6 +542,7 @@
|
|||||||
(slav %ud i.extra)
|
(slav %ud i.extra)
|
||||||
::
|
::
|
||||||
++ resource-for-update
|
++ resource-for-update
|
||||||
|
~/ %resource-for-update
|
||||||
|= =vase
|
|= =vase
|
||||||
^- (list resource)
|
^- (list resource)
|
||||||
%~ tap in
|
%~ tap in
|
||||||
|
Loading…
Reference in New Issue
Block a user