-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
37 lines (27 loc) · 863 Bytes
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
package main
import (
"context"
"log"
"github.com/coreos/go-systemd/daemon"
"github.com/pkg/errors"
"github.com/waltton/talktask/acd"
"github.com/waltton/talktask/config"
"github.com/waltton/talktask/handler"
"github.com/waltton/talktask/manager"
"github.com/waltton/talktask/ws"
)
func main() {
sm := manager.New(context.Background())
cfg, err := config.Load()
if err != nil {
log.Fatal(errors.Wrap(err, "Could not load config"))
}
jobs := make(chan acd.Job, cfg.Options.ACD.QueueSize)
runACD := acd.New(sm.Context, cfg.Options.ACD.PoolSize, jobs)
runWebServer := ws.New(sm.Context, cfg.Server, handler.New(jobs))
sm.CheckSigToQuit()
sm.RunServiceFunc(runWebServer)
sm.RunServiceFunc(runACD)
daemon.SdNotify(false, "READY=1") // Notify that is ready when running under systemd, not necessarily systemd socket
sm.WaitServices()
}