Skip to content

Commit dc8f5e6

Browse files
committed
monitor: log if there are no open sessions
1 parent df87a4f commit dc8f5e6

2 files changed

Lines changed: 6 additions & 2 deletions

File tree

discv5/driver_dialer.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,9 @@ func (d *DialDriver) monitorDatabase() {
138138
for {
139139
log.Infof("Looking for sessions to check...")
140140
sessions, err := d.dbc.FetchDueOpenSessions(ctx)
141-
if err != nil && !errors.Is(err, sql.ErrNoRows) {
141+
if errors.Is(err, sql.ErrNoRows) || len(sessions) == 0 {
142+
log.Infoln("No open sessions")
143+
} else if err != nil {
142144
log.WithError(err).Warnln("Could not fetch sessions")
143145
goto TICK
144146
}

libp2p/driver_dialer.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,9 @@ func (d *DialDriver) monitorDatabase() {
123123
for {
124124
log.Infof("Looking for sessions to check...")
125125
sessions, err := d.dbc.FetchDueOpenSessions(ctx)
126-
if err != nil && !errors.Is(err, sql.ErrNoRows) {
126+
if errors.Is(err, sql.ErrNoRows) || len(sessions) == 0 {
127+
log.Infoln("No open sessions")
128+
} else if err != nil {
127129
log.WithError(err).Warnln("Could not fetch sessions")
128130
goto TICK
129131
}

0 commit comments

Comments
 (0)