Skip to content

Commit

Permalink
catch nil event
Browse files Browse the repository at this point in the history
Signed-off-by: Angelo De Caro <[email protected]>
  • Loading branch information
adecaro committed Nov 28, 2024
1 parent 8bdbea8 commit 381d734
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion platform/view/services/db/driver/sql/postgres/notifier.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,11 @@ func NewNotifier(writeDB *sql.DB, table, dataSource string, notifyOperations []d

func (db *Notifier) listenForEvents() {
for event := range db.listener.Notify {
logger.Debugf("New event received on table [%s]: %s", event.Channel, event.Extra)
if event == nil {
logger.Warnf("nil event received on table [%s], investigate the possible cause", db.table)
continue
}
logger.Debugf("new event received on table [%s]: %s", event.Channel, event.Extra)
db.mutex.RLock()
for _, cb := range db.listeners {
if operation, payload, err := db.parsePayload(event.Extra); err != nil {
Expand Down

0 comments on commit 381d734

Please sign in to comment.