implement sqlite write queue

This commit is contained in:
2024-10-10 15:01:45 -05:00
parent 3574d07997
commit 1e33a81a2c
11 changed files with 225 additions and 192 deletions

View File

@@ -6,15 +6,20 @@ import (
"go-nkode/core"
"log"
"net/http"
"os"
)
const (
emailQueueBufferSize = 100
maxEmailsPerSecond = 13 // SES allows 14 but I don't want to push it
maxEmailsPerSecond = 13 // SES allows 14, but I don't want to push it
)
func main() {
db := core.NewSqliteDB("nkode.db")
dbPath := os.Getenv("SQLITE_DB")
if dbPath == "" {
log.Fatalf("SQLITE_DB=/path/to/nkode.db not set")
}
db := core.NewSqliteDB(dbPath)
defer db.CloseDb()
sesClient := core.NewSESClient()
emailQueue := core.NewEmailQueue(emailQueueBufferSize, maxEmailsPerSecond, &sesClient)