-
Notifications
You must be signed in to change notification settings - Fork 1
/
main.go
30 lines (23 loc) · 643 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
package main
import (
"time"
"github.com/BESTSELLER/nightscaler/config"
"github.com/BESTSELLER/nightscaler/logger"
"github.com/BESTSELLER/nightscaler/pubsub"
)
func main() {
config.Init()
logger.New(config.Config.Debug, config.Config.JsonLogging)
logger.Log.Info().Msg("Starting nightscaler")
logger.Log.Info().Msgf("Creating subscriber for topic %s in project %s", config.Config.ListenTopic, config.Config.ProjectID)
go func() {
for {
pubsub.SendNamespaces()
time.Sleep(10 * time.Minute)
}
}()
err := pubsub.Listen()
if err != nil {
logger.Log.Fatal().Err(err).Msg("failed to listen for Pub/Sub messages")
}
}