web: save events on timer

This commit is contained in:
Thomas Mathews 2022-12-20 18:52:34 -08:00
parent a5415906e9
commit add261dd01
3 changed files with 64 additions and 55 deletions

View file

@ -68,6 +68,7 @@ async function damus_web_init_ready() {
});
on_timer_timestamps();
on_timer_invalidations();
on_timer_save();
pool.on("open", on_pool_open);
pool.on("event", on_pool_event);
pool.on("notice", on_pool_notice);
@ -91,6 +92,13 @@ function on_timer_invalidations() {
}, 1 * 1000);
}
function on_timer_save() {
setTimeout(() => {
model_save_events(DAMUS);
on_timer_invalidations();
}, 10 * 1000);
}
/* on_pool_open occurs when a relay is opened. It then subscribes for the
* relative REQ as needed.
*/