ssbc / ssb-replication-scheduler

Plugin to trigger replication of feeds identified as friendly in the social graph
8 stars 1 forks source link

Pause reading the ssb-friends graph while db2 is indexing #7

Closed staltz closed 2 years ago

staltz commented 2 years ago

Context

https://github.com/ssbc/ssb-friends-purge/issues/1

Problem

ssb-replication-scheduler's use of hopStream means that it gets any graph updates during indexing which may reflect an older version of the social graph (where I was still friends with bob, before I started disagreeing with him).

Solution

Use ssb-db2's indexingActive to monitor the state of indexes, and if indexing is about to start, stop draining hopStream. Once done, resume draining hopStream.

1st :x: 2nd :heavy_check_mark: