all repos — flounder @ 8308051f6c5115e464f4402eb32755664e1c25de

A small site builder for the Gemini protocol

test deploy
alex wennerberg alex@alexwennerberg.com
Wed, 27 Jan 2021 16:10:27 -0800
commit

8308051f6c5115e464f4402eb32755664e1c25de

parent

644045262dc859da6a7d9cc59c89ca0d382bc7f9

2 files changed, 9 insertions(+), 3 deletions(-)

jump to
M log.golog.go

@@ -240,6 +240,13 @@ }

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 @@ ll.insertInto(db)

counter += 1 } log.Printf("Wrote %d logs\n", counter) + panic(nil) } func rotateLogs() {
M main.gomain.go

@@ -40,10 +40,8 @@

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