move worker to seperate package (eventually seperate binary)
This commit is contained in:
@@ -13,6 +13,7 @@ import (
|
|||||||
"time"
|
"time"
|
||||||
|
|
||||||
"astraltech.xyz/accountmanager/src/logging"
|
"astraltech.xyz/accountmanager/src/logging"
|
||||||
|
"astraltech.xyz/accountmanager/src/worker"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
@@ -365,7 +366,7 @@ func main() {
|
|||||||
ldapServerMutex.Unlock()
|
ldapServerMutex.Unlock()
|
||||||
defer closeLDAPServer(ldapServer)
|
defer closeLDAPServer(ldapServer)
|
||||||
|
|
||||||
createWorker(time.Minute*5, cleanupSessions)
|
worker.CreateWorker(time.Minute*5, cleanupSessions)
|
||||||
HandleFunc("/favicon.ico", faviconHandler)
|
HandleFunc("/favicon.ico", faviconHandler)
|
||||||
HandleFunc("/logo", logoHandler)
|
HandleFunc("/logo", logoHandler)
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
package main
|
package worker
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"time"
|
"time"
|
||||||
@@ -6,7 +6,7 @@ import (
|
|||||||
"astraltech.xyz/accountmanager/src/logging"
|
"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())
|
logging.Debugf("Creating worker that runs on a %s interval", interval.String())
|
||||||
go func() {
|
go func() {
|
||||||
ticker := time.NewTicker(interval)
|
ticker := time.NewTicker(interval)
|
||||||
Reference in New Issue
Block a user