mirror of
https://github.com/urbit/shrub.git
synced 2024-12-22 02:11:38 +03:00
hark-store: cleanup dangling unreads
Creates a noun poke %fix-dangling, which iterates through the unreads and dismiss those which refer to nodes which no longer exist. Additionally, adds a migration which runs this poke.
This commit is contained in:
parent
7e0af9cfca
commit
18301fa7d7
@ -21,13 +21,13 @@
|
|||||||
$% state:state-zero:store
|
$% state:state-zero:store
|
||||||
state:state-one:store
|
state:state-one:store
|
||||||
state-2
|
state-2
|
||||||
|
state-3
|
||||||
==
|
==
|
||||||
+$ unread-stats
|
+$ unread-stats
|
||||||
[indices=(set index:graph-store) last=@da]
|
[indices=(set index:graph-store) last=@da]
|
||||||
::
|
::
|
||||||
+$ state-2
|
+$ base-state
|
||||||
$: %2
|
$: unreads-each=(jug stats-index:store index:graph-store)
|
||||||
unreads-each=(jug stats-index:store index:graph-store)
|
|
||||||
unreads-count=(map stats-index:store @ud)
|
unreads-count=(map stats-index:store @ud)
|
||||||
last-seen=(map stats-index:store @da)
|
last-seen=(map stats-index:store @da)
|
||||||
=notifications:store
|
=notifications:store
|
||||||
@ -36,8 +36,14 @@
|
|||||||
dnd=_|
|
dnd=_|
|
||||||
==
|
==
|
||||||
::
|
::
|
||||||
|
+$ state-2
|
||||||
|
[%2 base-state]
|
||||||
|
::
|
||||||
|
+$ state-3
|
||||||
|
[%3 base-state]
|
||||||
|
::
|
||||||
+$ inflated-state
|
+$ inflated-state
|
||||||
$: state-2
|
$: state-3
|
||||||
cache
|
cache
|
||||||
==
|
==
|
||||||
:: $cache: useful to have precalculated, but can be derived from state
|
:: $cache: useful to have precalculated, but can be derived from state
|
||||||
@ -78,9 +84,16 @@
|
|||||||
=| cards=(list card)
|
=| cards=(list card)
|
||||||
|^
|
|^
|
||||||
?- -.old
|
?- -.old
|
||||||
%2
|
%3
|
||||||
:- cards
|
:- cards
|
||||||
this(-.state old, +.state (inflate-cache:ha old))
|
this(-.state old, +.state (inflate-cache:ha old))
|
||||||
|
::
|
||||||
|
%2
|
||||||
|
%_ $
|
||||||
|
-.old %3
|
||||||
|
cards :_(cards [%pass / %agent [our dap]:bowl %poke noun+!>(%fix-dangling)])
|
||||||
|
==
|
||||||
|
|
||||||
::
|
::
|
||||||
%1
|
%1
|
||||||
%_ $
|
%_ $
|
||||||
@ -264,10 +277,43 @@
|
|||||||
=^ cards state
|
=^ cards state
|
||||||
?+ mark (on-poke:def mark vase)
|
?+ mark (on-poke:def mark vase)
|
||||||
%hark-action (hark-action !<(action:store vase))
|
%hark-action (hark-action !<(action:store vase))
|
||||||
%noun ~& +.state [~ state]
|
%noun (poke-noun !<(* vase))
|
||||||
==
|
==
|
||||||
[cards this]
|
[cards this]
|
||||||
::
|
::
|
||||||
|
++ poke-noun
|
||||||
|
|= val=*
|
||||||
|
?+ val ~|(%bad-noun-poke !!)
|
||||||
|
%fix-dangling fix-dangling
|
||||||
|
%print ~&(+.state [~ state])
|
||||||
|
==
|
||||||
|
::
|
||||||
|
++ fix-dangling
|
||||||
|
=/ graphs=(set resource)
|
||||||
|
get-keys:gra
|
||||||
|
:_ state
|
||||||
|
%+ roll
|
||||||
|
~(tap by unreads-each)
|
||||||
|
|= $: [=stats-index:store indices=(set index:graph-store)]
|
||||||
|
out=(list card)
|
||||||
|
==
|
||||||
|
?. ?=(%graph -.stats-index) out
|
||||||
|
?. (~(has in graphs) graph.stats-index)
|
||||||
|
:_(out (poke-us %remove-graph graph.stats-index))
|
||||||
|
%+ weld out
|
||||||
|
^- (list card)
|
||||||
|
%+ turn
|
||||||
|
^- (list index:graph-store)
|
||||||
|
%+ skip
|
||||||
|
`(list index:graph-store)`~(tap in indices)
|
||||||
|
|=(=index:graph-store (check-node-existence:gra graph.stats-index index))
|
||||||
|
|=(=index:graph-store (poke-us %read-each stats-index index))
|
||||||
|
::
|
||||||
|
++ poke-us
|
||||||
|
|= =action:store
|
||||||
|
^- card
|
||||||
|
[%pass / %agent [our dap]:bowl %poke hark-action+!>(action)]
|
||||||
|
::
|
||||||
++ hark-action
|
++ hark-action
|
||||||
|= =action:store
|
|= =action:store
|
||||||
^- (quip card _state)
|
^- (quip card _state)
|
||||||
@ -636,7 +682,7 @@
|
|||||||
==
|
==
|
||||||
::
|
::
|
||||||
++ inflate-cache
|
++ inflate-cache
|
||||||
|= state-2
|
|= state-3
|
||||||
^+ +.state
|
^+ +.state
|
||||||
=/ nots=(list [p=@da =timebox:store])
|
=/ nots=(list [p=@da =timebox:store])
|
||||||
(tap:orm notifications)
|
(tap:orm notifications)
|
||||||
|
Loading…
Reference in New Issue
Block a user