forked from TrueCloudLab/frostfs-node
[#1546] morph/event: Remove nil checks from event handler registrar
This codepath hides possible bugs in code. We would rather panic then silently fail. Signed-off-by: Evgenii Stratonikov <e.stratonikov@yadro.com>
This commit is contained in:
parent
1f6cf57e30
commit
670305a721
2 changed files with 0 additions and 34 deletions
|
@ -459,12 +459,6 @@ func (l *listener) SetNotificationParser(pi NotificationParserInfo) {
|
|||
zap.Stringer("event_type", pi.getType()),
|
||||
)
|
||||
|
||||
parser := pi.parser()
|
||||
if parser == nil {
|
||||
log.Info(context.Background(), logs.EventIgnoreNilEventParser)
|
||||
return
|
||||
}
|
||||
|
||||
l.mtx.Lock()
|
||||
defer l.mtx.Unlock()
|
||||
|
||||
|
@ -492,12 +486,6 @@ func (l *listener) RegisterNotificationHandler(hi NotificationHandlerInfo) {
|
|||
zap.Stringer("event_type", hi.GetType()),
|
||||
)
|
||||
|
||||
handler := hi.Handler()
|
||||
if handler == nil {
|
||||
log.Warn(context.Background(), logs.EventIgnoreNilEventHandler)
|
||||
return
|
||||
}
|
||||
|
||||
// check if parser was set
|
||||
l.mtx.RLock()
|
||||
_, ok := l.notificationParsers[hi.scriptHashWithType]
|
||||
|
@ -555,12 +543,6 @@ func (l *listener) SetNotaryParser(pi NotaryParserInfo) {
|
|||
zap.Stringer("notary_type", pi.RequestType()),
|
||||
)
|
||||
|
||||
parser := pi.parser()
|
||||
if parser == nil {
|
||||
log.Info(context.Background(), logs.EventIgnoreNilNotaryEventParser)
|
||||
return
|
||||
}
|
||||
|
||||
l.mtx.Lock()
|
||||
defer l.mtx.Unlock()
|
||||
|
||||
|
@ -593,12 +575,6 @@ func (l *listener) RegisterNotaryHandler(hi NotaryHandlerInfo) {
|
|||
zap.Stringer("notary type", hi.RequestType()),
|
||||
)
|
||||
|
||||
handler := hi.Handler()
|
||||
if handler == nil {
|
||||
log.Warn(context.Background(), logs.EventIgnoreNilNotaryEventHandler)
|
||||
return
|
||||
}
|
||||
|
||||
// check if parser was set
|
||||
l.mtx.RLock()
|
||||
_, ok := l.notaryParsers[hi.notaryRequestTypes]
|
||||
|
@ -627,11 +603,6 @@ func (l *listener) Stop() {
|
|||
}
|
||||
|
||||
func (l *listener) RegisterBlockHandler(handler BlockHandler) {
|
||||
if handler == nil {
|
||||
l.log.Warn(context.Background(), logs.EventIgnoreNilBlockHandler)
|
||||
return
|
||||
}
|
||||
|
||||
l.blockHandlers = append(l.blockHandlers, handler)
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue