fix_: ctx not available when starting telemetry client (#5368)

This commit is contained in:
richΛrd 2024-06-17 15:15:11 -04:00 committed by GitHub
parent e9882e88d3
commit 83955bbc8a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 9 additions and 9 deletions

View File

@ -427,15 +427,6 @@ func NewMessenger(
anonMetricsServer.Logger = logger anonMetricsServer.Logger = logger
} }
var telemetryClient *telemetry.Client
if c.telemetryServerURL != "" {
telemetryClient = telemetry.NewClient(logger, c.telemetryServerURL, c.account.KeyUID, nodeName, version)
if c.wakuService != nil {
c.wakuService.SetStatusTelemetryClient(telemetryClient)
}
go telemetryClient.Start(messenger.ctx)
}
// Initialize push notification server // Initialize push notification server
var pushNotificationServer *pushnotificationserver.Server var pushNotificationServer *pushnotificationserver.Server
if c.pushNotificationServerConfig != nil && c.pushNotificationServerConfig.Enabled { if c.pushNotificationServerConfig != nil && c.pushNotificationServerConfig.Enabled {
@ -532,6 +523,15 @@ func NewMessenger(
ctx, cancel := context.WithCancel(context.Background()) ctx, cancel := context.WithCancel(context.Background())
var telemetryClient *telemetry.Client
if c.telemetryServerURL != "" {
telemetryClient = telemetry.NewClient(logger, c.telemetryServerURL, c.account.KeyUID, nodeName, version)
if c.wakuService != nil {
c.wakuService.SetStatusTelemetryClient(telemetryClient)
}
go telemetryClient.Start(ctx)
}
messenger = &Messenger{ messenger = &Messenger{
config: &c, config: &c,
node: node, node: node,