mirror of
https://github.com/aljazceru/njump.git
synced 2025-12-17 06:14:22 +01:00
fix: fill archives after 10 minutes and then every 24 hours instead.
This commit is contained in:
2
main.go
2
main.go
@@ -27,7 +27,7 @@ type Settings struct {
|
|||||||
TailwindDebug bool `envconfig:"TAILWIND_DEBUG"`
|
TailwindDebug bool `envconfig:"TAILWIND_DEBUG"`
|
||||||
SkipLanguageModel bool `envconfig:"SKIP_LANGUAGE_MODEL"`
|
SkipLanguageModel bool `envconfig:"SKIP_LANGUAGE_MODEL"`
|
||||||
RelayConfigPath string `envconfig:"RELAY_CONFIG_PATH"`
|
RelayConfigPath string `envconfig:"RELAY_CONFIG_PATH"`
|
||||||
TrustedPubKeys []string `envconfig:"TRUSTED_PUBKEYS" default:"7bdef7be22dd8e59f4600e044aa53a1cf975a9dc7d27df5833bc77db784a5805,3bf0c63fcb93463407af97a5e5ee64fa883d107ef9e558472c4eb9aaaefa459d,97c70a44366a6535c145b333f973ea86dfdc2d7a99da618c40c64705ad98e322,ee11a5dff40c19a555f41fe42b48f00e618c91225622ae37b6c2bb67b76c4e49"`
|
TrustedPubKeys []string `envconfig:"TRUSTED_PUBKEYS"`
|
||||||
}
|
}
|
||||||
|
|
||||||
//go:embed static/*
|
//go:embed static/*
|
||||||
|
|||||||
@@ -9,18 +9,20 @@ import (
|
|||||||
"github.com/nbd-wtf/go-nostr"
|
"github.com/nbd-wtf/go-nostr"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
var npubsArchive = make([]string, 0, 5000)
|
||||||
|
|
||||||
func updateArchives(ctx context.Context) {
|
func updateArchives(ctx context.Context) {
|
||||||
// do this so we don't run this every time we restart it locally
|
// do this so we don't run this every time we restart it locally
|
||||||
|
|
||||||
time.Sleep(10 * time.Minute)
|
time.Sleep(10 * time.Minute)
|
||||||
|
|
||||||
for {
|
for {
|
||||||
|
loadNpubsArchive(ctx)
|
||||||
|
loadRelaysArchive(ctx)
|
||||||
select {
|
select {
|
||||||
case <-ctx.Done():
|
case <-ctx.Done():
|
||||||
return
|
return
|
||||||
case <-time.After(24 * time.Hour):
|
case <-time.After(24 * time.Hour):
|
||||||
loadNpubsArchive(ctx)
|
|
||||||
loadRelaysArchive(ctx)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user