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
|
@ -164,17 +164,12 @@ const (
|
|||
EventNotaryParserNotSet = "notary parser not set"
|
||||
EventCouldNotParseNotaryEvent = "could not parse notary event"
|
||||
EventNotaryHandlersForParsedNotificationEventWereNotRegistered = "notary handlers for parsed notification event were not registered"
|
||||
EventIgnoreNilEventParser = "ignore nil event parser"
|
||||
EventListenerHasBeenAlreadyStartedIgnoreParser = "listener has been already started, ignore parser"
|
||||
EventRegisteredNewEventParser = "registered new event parser"
|
||||
EventIgnoreNilEventHandler = "ignore nil event handler"
|
||||
EventIgnoreHandlerOfEventWoParser = "ignore handler of event w/o parser"
|
||||
EventRegisteredNewEventHandler = "registered new event handler"
|
||||
EventIgnoreNilNotaryEventParser = "ignore nil notary event parser"
|
||||
EventListenerHasBeenAlreadyStartedIgnoreNotaryParser = "listener has been already started, ignore notary parser"
|
||||
EventIgnoreNilNotaryEventHandler = "ignore nil notary event handler"
|
||||
EventIgnoreHandlerOfNotaryEventWoParser = "ignore handler of notary event w/o parser"
|
||||
EventIgnoreNilBlockHandler = "ignore nil block handler"
|
||||
StorageOperation = "local object storage operation"
|
||||
BlobovniczaCreatingDirectoryForBoltDB = "creating directory for BoltDB"
|
||||
BlobovniczaOpeningBoltDB = "opening BoltDB"
|
||||
|
|
|
@ -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…
Reference in a new issue