move worker to seperate package (eventually seperate binary)

This commit is contained in:
2026-04-01 09:28:56 -04:00
parent c9c352204c
commit a058804603
2 changed files with 4 additions and 3 deletions

View File

@@ -13,6 +13,7 @@ import (
"time"
"astraltech.xyz/accountmanager/src/logging"
"astraltech.xyz/accountmanager/src/worker"
)
var (
@@ -365,7 +366,7 @@ func main() {
ldapServerMutex.Unlock()
defer closeLDAPServer(ldapServer)
createWorker(time.Minute*5, cleanupSessions)
worker.CreateWorker(time.Minute*5, cleanupSessions)
HandleFunc("/favicon.ico", faviconHandler)
HandleFunc("/logo", logoHandler)

View File

@@ -1,4 +1,4 @@
package main
package worker
import (
"time"
@@ -6,7 +6,7 @@ import (
"astraltech.xyz/accountmanager/src/logging"
)
func createWorker(interval time.Duration, task func()) {
func CreateWorker(interval time.Duration, task func()) {
logging.Debugf("Creating worker that runs on a %s interval", interval.String())
go func() {
ticker := time.NewTicker(interval)