Whenever we resubscribe, consider it an EOSE so we don't end up repeat-loading tons of events.

This commit is contained in:
Mike Dilger 2023-01-26 13:31:01 +13:00
parent f1a28a0a01
commit c008371981

View File

@ -704,6 +704,13 @@ impl Minion {
if self.subscriptions.has(handle) {
// Unsubscribe. will resubscribe under a new handle.
self.unsubscribe(handle).await?;
// Gratitously bump the EOSE as if the relay was finished, since it was
// our fault the subscription is getting cut off. This way we will pick up
// where we left off instead of potentially loading a bunch of events
// yet again.
let now = Unixtime::now().unwrap();
DbRelay::update_general_eose(self.dbrelay.url.clone(), now.0 as u64).await?;
}
self.subscriptions.add(handle, filters);
let req_message = self.subscriptions.get(handle).unwrap().req_message();