Skip to content

Commit

Permalink
Merge pull request urbit#5031 from urbit/lf/fix-unsubscribe
Browse files Browse the repository at this point in the history
-graph-leave: don't crash on inconsistent state
  • Loading branch information
tacryt-socryp authored Jul 2, 2021
2 parents b0f8a6e + 829fef1 commit 98ca90b
Showing 1 changed file with 20 additions and 26 deletions.
46 changes: 20 additions & 26 deletions pkg/arvo/ted/graph/leave.hoon
Original file line number Diff line number Diff line change
Expand Up @@ -4,42 +4,34 @@
|%
++ strand strand:spider
++ poke poke:strandio
++ poke-our poke-our:strandio
++ raw-poke-our raw-poke-our:strandio
::
++ scry-metadata
|= rid=resource
=/ m (strand ,resource)
^- form:m
;< group=(unit resource) bind:m
%+ scry:strandio ,(unit resource)
;: weld
/gx/metadata-store/resource/graph
(en-path:resource rid)
/noun
==
(pure:m (need group))
%+ scry:strandio ,(unit resource)
;: weld
/gx/metadata-store/resource/graph
(en-path:resource rid)
/noun
==
::
++ scry-group
|= rid=resource
=/ m (strand ,group)
^- form:m
;< ugroup=(unit group) bind:m
%+ scry:strandio ,(unit group)
;: weld
/gx/group-store/groups
(en-path:resource rid)
/noun
==
(pure:m (need ugroup))
%+ scry:strandio ,(unit group)
;: weld
/gx/group-store/groups
(en-path:resource rid)
/noun
==
::
++ delete-graph
|= [now=time rid=resource]
=/ m (strand ,~)
^- form:m
;< ~ bind:m
(poke-our %graph-pull-hook %pull-hook-action !>([%remove rid]))
(raw-poke-our %graph-pull-hook %pull-hook-action !>([%remove rid]))
;< ~ bind:m
(poke-our %graph-store %graph-update-2 !>([now [%remove-graph rid]]))
(raw-poke-our %graph-store %graph-update-2 !>([now [%remove-graph rid]]))
(pure:m ~)
--
::
Expand All @@ -52,10 +44,12 @@
;< =bowl:spider bind:m get-bowl:strandio
?: =(our.bowl entity.rid.action)
(strand-fail:strandio %bad-request ~)
;< group-rid=resource bind:m (scry-metadata rid.action)
;< g=group bind:m (scry-group group-rid)
;< group-rid=(unit resource) bind:m (scry-metadata rid.action)
?~ group-rid (pure:m !>(~))
;< g=(unit group) bind:m (scry-group u.group-rid)
?~ g (pure:m !>(~))
;< ~ bind:m (delete-graph now.bowl rid.action)
?. hidden.g
?. hidden.u.g
(pure:m !>(~))
;< =thread-result:strandio bind:m
(await-thread:strandio %group-leave !>([~ [%leave rid.action]]))
Expand Down

0 comments on commit 98ca90b

Please sign in to comment.