diff options
| author | 2025-10-25 19:41:49 +0700 | |
|---|---|---|
| committer | 2025-10-25 19:41:49 +0700 | |
| commit | 634fa487aa91c1a12af0ddb0cb0744c27df12c04 (patch) | |
| tree | c2cd8de15a4005505bfe450c64e6e88ef1bd1f32 | |
| parent | 249f73a7eff43994ed91fb1e1bef8edf5ac6c86a (diff) | |
| download | web-634fa487aa91c1a12af0ddb0cb0744c27df12c04.tar.gz web-634fa487aa91c1a12af0ddb0cb0744c27df12c04.zip | |
feat: enable WAL journal mode for db
fix: green colors on unsubscribe page
feat: properly shutdown blog trigger scheduler
| -rw-r--r-- | config/config.local.yaml | 2 | ||||
| -rw-r--r-- | config/config.prod.yaml | 2 | ||||
| -rw-r--r-- | config/config.stage.yaml | 2 | ||||
| -rw-r--r-- | internal/blogtrigger/blogtrigger.go | 4 | ||||
| -rw-r--r-- | internal/router/lang-user-unsubscribe.go | 2 | ||||
| -rw-r--r-- | main.go | 3 |
6 files changed, 11 insertions, 4 deletions
diff --git a/config/config.local.yaml b/config/config.local.yaml index d40e8e9..327bad4 100644 --- a/config/config.local.yaml +++ b/config/config.local.yaml @@ -32,7 +32,7 @@ auth: db: type: sqlite3 config: - dsn: 'file:/tmp/auth.db?cache=shared&mode=rwc' + dsn: 'file:/tmp/auth.db?cache=shared&mode=rwc&_journal_mode=WAL' salt: '123' mail: clientHost: '127.0.0.1:3000' diff --git a/config/config.prod.yaml b/config/config.prod.yaml index 7a9e5ae..0bee79d 100644 --- a/config/config.prod.yaml +++ b/config/config.prod.yaml @@ -32,7 +32,7 @@ auth: db: type: sqlite3 config: - dsn: 'file:/data/auth.db?cache=private&mode=rwc&_locking_mode=EXCLUSIVE&_mutex=no&_auto_vacuum=2' + dsn: 'file:/data/auth.db?cache=private&mode=rwc&_locking_mode=EXCLUSIVE&_mutex=no&_auto_vacuum=2&_journal_mode=WAL' salt: '${AUTH_SALT}' mail: clientHost: '${FQDN}' diff --git a/config/config.stage.yaml b/config/config.stage.yaml index 8a5fde1..1c15dae 100644 --- a/config/config.stage.yaml +++ b/config/config.stage.yaml @@ -32,7 +32,7 @@ auth: db: type: sqlite3 config: - dsn: 'file:/data/auth.db?cache=private&mode=rwc&_locking_mode=EXCLUSIVE&_mutex=no&_auto_vacuum=2' + dsn: 'file:/data/auth.db?cache=private&mode=rwc&_locking_mode=EXCLUSIVE&_mutex=no&_auto_vacuum=2&_journal_mode=WAL' salt: '${AUTH_SALT}' mail: clientHost: '${FQDN}' diff --git a/internal/blogtrigger/blogtrigger.go b/internal/blogtrigger/blogtrigger.go index 9b016e8..c5b3097 100644 --- a/internal/blogtrigger/blogtrigger.go +++ b/internal/blogtrigger/blogtrigger.go @@ -49,6 +49,10 @@ func NewBlogTriggerScheduler(b2Client *b2.B2Client, availableLanguages []config. return bts, nil } +func (bts *BlogTriggerScheduler) Close() error { + return bts.s.Shutdown() +} + func (bts *BlogTriggerScheduler) scan() (newPages []*b2.BlogPage, err error) { newPages = make([]*b2.BlogPage, 0) for lang := range bts.knownBlogPages { diff --git a/internal/router/lang-user-unsubscribe.go b/internal/router/lang-user-unsubscribe.go index a6ca89f..81d1bfb 100644 --- a/internal/router/lang-user-unsubscribe.go +++ b/internal/router/lang-user-unsubscribe.go @@ -45,7 +45,7 @@ func Lang_User_Unsubscribe(l map[string]*locale.LocaleConfig, langs []config.Ava statusText = l[lang].UnsubscribePage.OnServerError status = fiber.ErrInternalServerError.Code } else { - statusColor = "0, 255, 0," + statusColor = "0, 255, 0" statusEmoji = "♡⸜(˶˃ ᵕ ˂˶)⸝♡" statusText = l[lang].UnsubscribePage.Success status = fiber.StatusOK @@ -202,6 +202,9 @@ func main() { <-sigChan slog.Info("gracefully shutting down...") + if err = router.BlogTrigger.Close(); err != nil { + slog.Error("fail to shutdown blog trigger scheduler", slog.String("error", err.Error())) + } if err = app.Shutdown(); err != nil { slog.Error("fail to shutdown fiber server", slog.String("error", err.Error())) } |