flounder

A simple gemini site builder
Log | Files | Refs | README | LICENSE

commit 8308051f6c5115e464f4402eb32755664e1c25de
parent 644045262dc859da6a7d9cc59c89ca0d382bc7f9
Author: alex wennerberg <alex@alexwennerberg.com>
Date:   Wed, 27 Jan 2021 16:10:27 -0800

test deploy

Diffstat:
Mlog.go | 8++++++++
Mmain.go | 4+---
2 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/log.go b/log.go @@ -240,6 +240,13 @@ func lineToLogLine(line string) (*LogLine, error) { return &result, nil } +func dumpLogsWorker() { + log.Println("Starting analytics log writing worker") + for { + dumpLogs() + time.Sleep(time.Minute * 5) + } +} func dumpLogs() { log.Println("Writing missing logs to database") db, err := getAnalyticsDB() @@ -281,6 +288,7 @@ func dumpLogs() { counter += 1 } log.Printf("Wrote %d logs\n", counter) + panic(nil) } func rotateLogs() { diff --git a/main.go b/main.go @@ -40,10 +40,8 @@ func main() { cookie := generateCookieKeyIfDNE() SessionStore = sessions.NewCookieStore(cookie) - // handle background tasks - // s1 := gocron.NewScheduler(time.UTC) if c.AnalyticsDBFile != "" { - // s1.Every(5).Minute().Do(dumpLogs) + go dumpLogsWorker() } // load domains in memory