link-store: don't send update if not new

We were taking care not to re-add something to our data store if we
already had it in there, but were still sending out an update
regardless.

With this, we only send out an update if we weren't previously aware
of the content.
This commit is contained in:
Fang 2020-03-25 22:12:49 +01:00
parent 16b4e2e8e4
commit 073b86be15
No known key found for this signature in database
GPG Key ID: EB035760C1BBA972

View File

@ -320,7 +320,10 @@
:: add link to group submissions
::
=/ =links (~(gut by by-group) path *links)
=. submissions.links
=^ added submissions.links
?: ?=(^ (find ~[submission] submissions.links))
[| submissions.links]
:- &
(submissions:merge submissions.links ~[submission])
=. by-group (~(put by by-group) path links)
:: add submission to global sites
@ -330,6 +333,7 @@
:: send updates to subscribers
::
:_ state
?. added ~
:_ ~
:+ %give %fact
:+ :~ /submissions
@ -346,13 +350,17 @@
::
=/ urls (~(gut by discussions) path *(map ^url discussion))
=/ =discussion (~(gut by urls) url *discussion)
=. comments.discussion
=^ added comments.discussion
?: ?=(^ (find ~[comment] comments.discussion))
[| comments.discussion]
:- &
(comments:merge comments.discussion ~[comment])
=. urls (~(put by urls) url discussion)
=. discussions (~(put by discussions) path urls)
:: send updates to subscribers
::
:_ state
?. added ~
:_ ~
:+ %give %fact
:+ :~ /discussions