0

[WIP] Add cron-like job for periodic maintenance of settings db, update TODO.md

This commit is contained in:
eleksir
2025-11-02 12:22:37 +03:00
parent fbd0196a48
commit 61208f5247
13 changed files with 504 additions and 12 deletions

View File

@@ -11,6 +11,7 @@ import (
"aleesa-telegram-go/internal/log"
"aleesa-telegram-go/internal/tg"
"github.com/carlescere/scheduler"
"github.com/go-redis/redis/v8"
)
@@ -88,6 +89,13 @@ func main() {
go tg.SigHandler()
go tg.Telega(tg.Config)
// Periodically compact/flush pebble dbs.
if job, err := scheduler.Every(1).Hours().NotImmediately().Run(tg.TidySettingsDB); err != nil {
log.Errorf("Unable to schedule periodic settings db flush: %s", err)
} else {
tg.PeriodicJobs = append(tg.PeriodicJobs, job)
}
// Обработчик событий от редиски.
for msg := range redisMsgChan {
if tg.Shutdown {