1

Update dependencies

This commit is contained in:
Vladimir Hodakov 2019-02-12 03:06:00 +04:00
parent 3c9390a295
commit 89a4edb13f
Signed by: Vladimir Hodakov
GPG Key ID: 673980B6882F82C6
11 changed files with 13 additions and 19 deletions

View File

@ -8,7 +8,7 @@ import (
"github.com/rs/zerolog"
"gopkg.in/yaml.v2"
"io/ioutil"
"lab.wtfteam.pro/fat0troll/fw_zookeeper_helper/local/config"
"lab.wtfteam.pro/fat0troll/fw_zookeeper_helper/internal/config"
"os"
"path/filepath"
"runtime"

View File

@ -5,7 +5,7 @@ package context
import (
"github.com/rs/zerolog"
"lab.wtfteam.pro/fat0troll/fw_zookeeper_helper/local/config"
"lab.wtfteam.pro/fat0troll/fw_zookeeper_helper/internal/config"
)
// VERSION is the current bot's version
@ -15,12 +15,10 @@ const VERSION = "0.0.2"
type Context struct {
Config *config.Struct
Logger zerolog.Logger
ShutdownDone chan bool
}
// NewContext is an initialization function for Context
func NewContext() *Context {
c := &Context{}
c.ShutdownDone = make(chan bool, 1)
return c
}

View File

@ -72,8 +72,5 @@ func ZookeeperReceiver(client *tdlib.Client) {
}
}
}
<-c.ShutdownDone
return
}()
}

1
go.mod
View File

@ -3,5 +3,6 @@ module lab.wtfteam.pro/fat0troll/fw_zookeeper_helper
require (
github.com/Arman92/go-tdlib v0.0.0-20181103144727-9577ff528640
github.com/rs/zerolog v1.11.0
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 // indirect
gopkg.in/yaml.v2 v2.2.2
)

1
go.sum
View File

@ -4,5 +4,6 @@ github.com/rs/zerolog v1.11.0 h1:DRuq/S+4k52uJzBQciUcofXx45GrMC6yrEbb/CoK6+M=
github.com/rs/zerolog v1.11.0/go.mod h1:YbFCdg8HfsridGWAh22vktObvhZbQsZXe4/zB0OKkWU=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/yaml.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw=
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=

View File

@ -73,9 +73,6 @@ func Authenticate() {
func Connect() {
go func() {
announcesv1.ZookeeperReceiver(client)
<-c.ShutdownDone
return
}()
rawUpdates := client.GetRawUpdatesChannel(100)
log.Debug().Msg("Connection with Telegram established")

14
main.go
View File

@ -6,7 +6,7 @@ package main
import (
"lab.wtfteam.pro/fat0troll/fw_zookeeper_helper/context"
"lab.wtfteam.pro/fat0troll/fw_zookeeper_helper/domains/announces/v1"
"lab.wtfteam.pro/fat0troll/fw_zookeeper_helper/local/telegram"
"lab.wtfteam.pro/fat0troll/fw_zookeeper_helper/internal/telegram"
"os"
"os/signal"
"runtime"
@ -19,14 +19,17 @@ func main() {
runtime.LockOSThread()
// Initializing context
c := context.NewContext()
c.Init()
c.InitConfiguration()
announcesv1.New(c)
telegram.New(c)
// CTRL+C handler.
interrupt := make(chan os.Signal, 1)
signal.Notify(interrupt)
shutdownDone := make(chan bool, 1)
go func() {
signalThing := <-interrupt
if signalThing == syscall.SIGTERM || signalThing == syscall.SIGINT {
@ -34,14 +37,11 @@ func main() {
telegram.Shutdown()
c.ShutdownDone <- true
shutdownDone <- true
}
}()
announcesv1.New(c)
telegram.New(c)
<-c.ShutdownDone
<-shutdownDone
os.Exit(0)
}