[#1437] blobovnicza: Fix contextcheck linter

Signed-off-by: Dmitrii Stepanov <d.stepanov@yadro.com>
This commit is contained in:
Dmitrii Stepanov 2024-10-21 11:20:17 +03:00
parent 6db46257c0
commit 62b5181618
Signed by: dstepanov-yadro
GPG key ID: 237AF1A763293BC0
22 changed files with 82 additions and 81 deletions

View file

@ -269,7 +269,7 @@ loop:
continue loop
}
l.handleNotifyEvent(notifyEvent)
l.handleNotifyEvent(ctx, notifyEvent)
case notaryEvent, ok := <-chs.NotaryRequestsCh:
if !ok {
l.log.Warn(ctx, logs.EventStopEventListenerByNotaryChannel)
@ -316,16 +316,16 @@ func (l *listener) handleNotaryEvent(notaryEvent *result.NotaryRequestEvent) {
}
}
func (l *listener) handleNotifyEvent(notifyEvent *state.ContainedNotificationEvent) {
func (l *listener) handleNotifyEvent(ctx context.Context, notifyEvent *state.ContainedNotificationEvent) {
if err := l.pool.Submit(func() {
l.parseAndHandleNotification(notifyEvent)
l.parseAndHandleNotification(ctx, notifyEvent)
}); err != nil {
l.log.Warn(context.Background(), logs.EventListenerWorkerPoolDrained,
l.log.Warn(ctx, logs.EventListenerWorkerPoolDrained,
zap.Int("capacity", l.pool.Cap()))
}
}
func (l *listener) parseAndHandleNotification(notifyEvent *state.ContainedNotificationEvent) {
func (l *listener) parseAndHandleNotification(ctx context.Context, notifyEvent *state.ContainedNotificationEvent) {
log := l.log.With(
zap.String("script hash LE", notifyEvent.ScriptHash.StringLE()),
)
@ -347,7 +347,7 @@ func (l *listener) parseAndHandleNotification(notifyEvent *state.ContainedNotifi
l.mtx.RUnlock()
if !ok {
log.Debug(context.Background(), logs.EventEventParserNotSet)
log.Debug(ctx, logs.EventEventParserNotSet)
return
}
@ -355,7 +355,7 @@ func (l *listener) parseAndHandleNotification(notifyEvent *state.ContainedNotifi
// parse the notification event
event, err := parser(notifyEvent)
if err != nil {
log.Warn(context.Background(), logs.EventCouldNotParseNotificationEvent,
log.Warn(ctx, logs.EventCouldNotParseNotificationEvent,
zap.String("error", err.Error()),
)
@ -368,7 +368,7 @@ func (l *listener) parseAndHandleNotification(notifyEvent *state.ContainedNotifi
l.mtx.RUnlock()
if len(handlers) == 0 {
log.Info(context.Background(), logs.EventNotificationHandlersForParsedNotificationEventWereNotRegistered,
log.Info(ctx, logs.EventNotificationHandlersForParsedNotificationEventWereNotRegistered,
zap.Any("event", event),
)