|
@@ -120,7 +120,6 @@ func MessageQueue(ctx context.Context, network string) {
|
|
ncutils.Log("netclient go routine started for " + network)
|
|
ncutils.Log("netclient go routine started for " + network)
|
|
var cfg config.ClientConfig
|
|
var cfg config.ClientConfig
|
|
cfg.Network = network
|
|
cfg.Network = network
|
|
- ncutils.Log("pulling latest config for " + cfg.Network)
|
|
|
|
var configPath = fmt.Sprintf("%snetconfig-%s", ncutils.GetNetclientPathSpecific(), network)
|
|
var configPath = fmt.Sprintf("%snetconfig-%s", ncutils.GetNetclientPathSpecific(), network)
|
|
fileInfo, err := os.Stat(configPath)
|
|
fileInfo, err := os.Stat(configPath)
|
|
if err != nil {
|
|
if err != nil {
|
|
@@ -129,10 +128,13 @@ func MessageQueue(ctx context.Context, network string) {
|
|
// speed up UDP rest
|
|
// speed up UDP rest
|
|
if time.Now().After(fileInfo.ModTime().Add(time.Minute)) {
|
|
if time.Now().After(fileInfo.ModTime().Add(time.Minute)) {
|
|
sleepTime := 2
|
|
sleepTime := 2
|
|
|
|
+ ncutils.Log("pulling latest config for " + cfg.Network)
|
|
for {
|
|
for {
|
|
_, err := Pull(network, true)
|
|
_, err := Pull(network, true)
|
|
if err == nil {
|
|
if err == nil {
|
|
break
|
|
break
|
|
|
|
+ } else {
|
|
|
|
+ ncutils.PrintLog("error pulling config for "+network+": "+err.Error(), 1)
|
|
}
|
|
}
|
|
if sleepTime > 3600 {
|
|
if sleepTime > 3600 {
|
|
sleepTime = 3600
|
|
sleepTime = 3600
|
|
@@ -511,7 +513,7 @@ func PublishNodeUpdate(cfg *config.ClientConfig) {
|
|
|
|
|
|
// Hello -- ping the broker to let server know node is alive and doing fine
|
|
// Hello -- ping the broker to let server know node is alive and doing fine
|
|
func Hello(cfg *config.ClientConfig, network string) {
|
|
func Hello(cfg *config.ClientConfig, network string) {
|
|
- if err := publish(cfg, fmt.Sprintf("ping/%s", cfg.Node.ID), []byte("hello world!")); err != nil {
|
|
|
|
|
|
+ if err := publish(cfg, fmt.Sprintf("ping/%s", cfg.Node.ID), []byte(ncutils.Version)); err != nil {
|
|
ncutils.Log(fmt.Sprintf("error publishing ping, %v", err))
|
|
ncutils.Log(fmt.Sprintf("error publishing ping, %v", err))
|
|
ncutils.Log("running pull on " + cfg.Node.Network + " to reconnect")
|
|
ncutils.Log("running pull on " + cfg.Node.Network + " to reconnect")
|
|
_, err := Pull(cfg.Node.Network, true)
|
|
_, err := Pull(cfg.Node.Network, true)
|