move worker to seperate package (eventually seperate binary)
This commit is contained in:
@@ -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)
|
||||
|
||||
|
||||
@@ -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)
|
||||
Reference in New Issue
Block a user