Skip to content

Commit 39af9bf

Browse files
committed
handle all errors
1 parent 633a3f8 commit 39af9bf

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

dbos/system_database.go

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -331,7 +331,6 @@ func (s *sysDB) shutdown(ctx context.Context, timeout time.Duration) {
331331

332332
if s.launched {
333333
// Wait for the notification loop to exit
334-
s.logger.Debug("DBOS: Waiting for notification listener loop to finish")
335334
select {
336335
case <-s.notificationLoopDone:
337336
case <-time.After(timeout):
@@ -1572,17 +1571,26 @@ func (s *sysDB) notificationListenerLoop(ctx context.Context) {
15721571
return nil, err
15731572
}
15741573
if _, err = tx.Exec(ctx, fmt.Sprintf("LISTEN %s", _DBOS_NOTIFICATIONS_CHANNEL)); err != nil {
1575-
_ = tx.Rollback(ctx)
1574+
rErr := tx.Rollback(ctx)
1575+
if rErr != nil {
1576+
s.logger.Error("Failed to rollback transaction after LISTEN error", "error", rErr)
1577+
}
15761578
pc.Release()
15771579
return nil, err
15781580
}
15791581
if _, err = tx.Exec(ctx, fmt.Sprintf("LISTEN %s", _DBOS_WORKFLOW_EVENTS_CHANNEL)); err != nil {
1580-
_ = tx.Rollback(ctx)
1582+
rErr := tx.Rollback(ctx)
1583+
if rErr != nil {
1584+
s.logger.Error("Failed to rollback transaction after LISTEN error", "error", rErr)
1585+
}
15811586
pc.Release()
15821587
return nil, err
15831588
}
15841589
if err = tx.Commit(ctx); err != nil {
1585-
_ = tx.Rollback(ctx)
1590+
rErr := tx.Rollback(ctx)
1591+
if rErr != nil {
1592+
s.logger.Error("Failed to rollback transaction after COMMIT error", "error", rErr)
1593+
}
15861594
pc.Release()
15871595
return nil, err
15881596
}

0 commit comments

Comments
 (0)