fix: fill archives after 10 minutes and then every 24 hours instead.

This commit is contained in:
fiatjaf
2024-06-12 15:18:35 -03:00
parent aeb98ca535
commit a7d29b151a
2 changed files with 5 additions and 3 deletions

View File

@@ -9,18 +9,20 @@ import (
"github.com/nbd-wtf/go-nostr"
)
var npubsArchive = make([]string, 0, 5000)
func updateArchives(ctx context.Context) {
// do this so we don't run this every time we restart it locally
time.Sleep(10 * time.Minute)
for {
loadNpubsArchive(ctx)
loadRelaysArchive(ctx)
select {
case <-ctx.Done():
return
case <-time.After(24 * time.Hour):
loadNpubsArchive(ctx)
loadRelaysArchive(ctx)
}
}
}