mirror of
https://github.com/ilyakooo0/urbit.git
synced 2024-12-14 08:34:25 +03:00
tally: be safer wrt mangled metadata
Previously, if metadata-store said a graph existed, we'd unconditionally scry for it. Now, we make sure the graph actually exists, to avoid risking a crash.
This commit is contained in:
parent
7d451a37b8
commit
883a56382f
@ -61,14 +61,24 @@
|
||||
::NOTE we only count graphs for now
|
||||
?. &(=(%graph app-name.m) =(our creator.metadatum)) ~
|
||||
`[module.metadatum resource.m]
|
||||
:: for sanity checks
|
||||
::
|
||||
=/ real=(set resource:re)
|
||||
=/ upd=update:ga
|
||||
%+ scry update:ga
|
||||
[%x %graph-store /keys/graph-update]
|
||||
?> ?=(%keys -.q.upd)
|
||||
resources.q.upd
|
||||
:: count activity per channel
|
||||
::
|
||||
=/ activity=(list [resource:re members=@ud (list [resource:re mod=term week=@ud authors=@ud])])
|
||||
%+ turn crowds
|
||||
|= [g=resource:re m=@ud]
|
||||
:+ g m
|
||||
%+ turn (~(got by channels) g)
|
||||
%+ murn (~(got by channels) g)
|
||||
|= [m=term r=resource:re]
|
||||
?. (~(has in real) r) ~
|
||||
%- some
|
||||
:+ r m
|
||||
::NOTE graph-store doesn't use the full resource-style path here!
|
||||
=/ upd=update:ga
|
||||
|
Loading…
Reference in New Issue
Block a user