mirror of
https://github.com/Icinga/icingadb.git
synced 2026-05-28 04:35:54 -04:00
Use env in config sync
This commit is contained in:
parent
3229039a73
commit
0c848e439e
3 changed files with 16 additions and 11 deletions
|
|
@ -196,7 +196,9 @@ func GetDelta(super *supervisor.Supervisor, ctx *Context) ([]string, []string, [
|
|||
go func() {
|
||||
defer wg.Done()
|
||||
var err error
|
||||
mysqlIds, err = super.Dbw.SqlFetchIds(ctx.ObjectType)
|
||||
super.EnvLock.Lock()
|
||||
mysqlIds, err = super.Dbw.SqlFetchIds(super.EnvId, ctx.ObjectType)
|
||||
super.EnvLock.Unlock()
|
||||
if err != nil {
|
||||
super.ChErr <- err
|
||||
return
|
||||
|
|
|
|||
10
main.go
10
main.go
|
|
@ -12,6 +12,7 @@ import (
|
|||
"git.icinga.com/icingadb/icingadb-main/prometheus"
|
||||
"git.icinga.com/icingadb/icingadb-main/supervisor"
|
||||
log "github.com/sirupsen/logrus"
|
||||
"sync"
|
||||
)
|
||||
|
||||
func main() {
|
||||
|
|
@ -37,16 +38,17 @@ func main() {
|
|||
|
||||
super := supervisor.Supervisor{
|
||||
ChErr: make(chan error),
|
||||
ChEnv: make(chan *icingadb_ha.Environment),
|
||||
ChDecode: make(chan *icingadb_json_decoder.JsonDecodePackages),
|
||||
Rdbw: redisConn,
|
||||
Dbw: mysqlConn,
|
||||
EnvLock: &sync.Mutex{},
|
||||
}
|
||||
|
||||
ha := icingadb_ha.HA{}
|
||||
go ha.Run(super.Rdbw, super.Dbw, super.ChEnv, super.ChErr)
|
||||
chEnv := make(chan *icingadb_ha.Environment)
|
||||
ha := icingadb_ha.NewHA(super)
|
||||
go ha.Run(super.Rdbw, super.Dbw, chEnv, super.ChErr)
|
||||
go func() {
|
||||
super.ChErr <- icingadb_ha.IcingaEventsBroker(redisConn, super.ChEnv)
|
||||
super.ChErr <- icingadb_ha.IcingaEventsBroker(redisConn, chEnv)
|
||||
}()
|
||||
|
||||
go icingadb_json_decoder.DecodePool(super.ChDecode, super.ChErr, 16)
|
||||
|
|
|
|||
|
|
@ -3,13 +3,14 @@ package supervisor
|
|||
import (
|
||||
"git.icinga.com/icingadb/icingadb-connection"
|
||||
"git.icinga.com/icingadb/icingadb-json-decoder"
|
||||
"git.icinga.com/icingadb/icingadb-ha"
|
||||
"sync"
|
||||
)
|
||||
|
||||
type Supervisor struct {
|
||||
ChErr chan error
|
||||
ChEnv chan *icingadb_ha.Environment
|
||||
ChDecode chan *icingadb_json_decoder.JsonDecodePackages
|
||||
Rdbw *icingadb_connection.RDBWrapper
|
||||
Dbw *icingadb_connection.DBWrapper
|
||||
ChErr chan error
|
||||
ChDecode chan *icingadb_json_decoder.JsonDecodePackages
|
||||
Rdbw *icingadb_connection.RDBWrapper
|
||||
Dbw *icingadb_connection.DBWrapper
|
||||
EnvId []byte
|
||||
EnvLock *sync.Mutex
|
||||
}
|
||||
Loading…
Reference in a new issue