fix: enable bandwidth stats depending on node config setting
This commit is contained in:
parent
cee18efd71
commit
0fc8c036b1
|
@ -597,6 +597,9 @@ type ShhextConfig struct {
|
||||||
|
|
||||||
// AnonMetricsServerPostgresURI is the uri used to connect to a postgres db
|
// AnonMetricsServerPostgresURI is the uri used to connect to a postgres db
|
||||||
AnonMetricsServerPostgresURI string
|
AnonMetricsServerPostgresURI string
|
||||||
|
|
||||||
|
// BandwidthStatsEnabled indicates if a signal is going to be emitted to indicate the upload and download rate
|
||||||
|
BandwidthStatsEnabled bool
|
||||||
}
|
}
|
||||||
|
|
||||||
// Validate validates the ShhextConfig struct and returns an error if inconsistent values are found
|
// Validate validates the ShhextConfig struct and returns an error if inconsistent values are found
|
||||||
|
|
|
@ -164,7 +164,11 @@ func (s *Service) StartMessenger() (*protocol.MessengerResponse, error) {
|
||||||
}
|
}
|
||||||
go s.retrieveMessagesLoop(time.Second, s.cancelMessenger)
|
go s.retrieveMessagesLoop(time.Second, s.cancelMessenger)
|
||||||
go s.verifyTransactionLoop(30*time.Second, s.cancelMessenger)
|
go s.verifyTransactionLoop(30*time.Second, s.cancelMessenger)
|
||||||
|
|
||||||
|
if s.config.BandwidthStatsEnabled {
|
||||||
go s.retrieveStats(5*time.Second, s.cancelMessenger)
|
go s.retrieveStats(5*time.Second, s.cancelMessenger)
|
||||||
|
}
|
||||||
|
|
||||||
return response, nil
|
return response, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue