Browse Source

Update dependencies

tags/1.0.0
Vladimir Hodakov 1 year ago
parent
commit
89a4edb13f
Signed by: fat0troll <vladimir@hodakov.me> GPG Key ID: 673980B6882F82C6
11 changed files with 13 additions and 19 deletions
  1. +1
    -1
      context/context.go
  2. +3
    -5
      context/exported.go
  3. +0
    -3
      domains/announces/v1/announces.go
  4. +1
    -0
      go.mod
  5. +1
    -0
      go.sum
  6. +0
    -0
      internal/config/announce.go
  7. +0
    -0
      internal/config/struct.go
  8. +0
    -0
      internal/config/tdlib.go
  9. +0
    -0
      internal/telegram/exported.go
  10. +0
    -3
      internal/telegram/telegram.go
  11. +7
    -7
      main.go

+ 1
- 1
context/context.go 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"


+ 3
- 5
context/exported.go 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
@@ -13,14 +13,12 @@ const VERSION = "0.0.2"

// Context is the main application context.
type Context struct {
Config *config.Struct
Logger zerolog.Logger
ShutdownDone chan bool
Config *config.Struct
Logger zerolog.Logger
}

// NewContext is an initialization function for Context
func NewContext() *Context {
c := &Context{}
c.ShutdownDone = make(chan bool, 1)
return c
}

+ 0
- 3
domains/announces/v1/announces.go View File

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

<-c.ShutdownDone
return
}()
}

+ 1
- 0
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
- 0
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=

local/config/announce.go → internal/config/announce.go View File


local/config/struct.go → internal/config/struct.go View File


local/config/tdlib.go → internal/config/tdlib.go View File


local/telegram/exported.go → internal/telegram/exported.go View File


local/telegram/telegram.go → internal/telegram/telegram.go 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")

+ 7
- 7
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)

}

Loading…
Cancel
Save