Skip to content

Commit

Permalink
keep cache loop alive in case of panics
Browse files Browse the repository at this point in the history
  • Loading branch information
pk910 committed Apr 10, 2024
1 parent 5eab62c commit a938c79
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion indexer/cache_logic.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package indexer

import (
"fmt"
"runtime/debug"
"time"

"github.com/ethpandaops/dora/db"
Expand All @@ -26,7 +27,13 @@ func (cache *indexerCache) runCacheLoop() {
}
}

func (cache *indexerCache) runCacheLogic() error {
func (cache *indexerCache) runCacheLogic() (err error) {
defer func() {
if err2 := recover(); err2 != nil {
err = fmt.Errorf("uncaught panic in runCacheLogic subroutine: %v, stack: %v", err2, string(debug.Stack()))
}
}()

if cache.highestSlot < 0 {
return nil
}
Expand Down

0 comments on commit a938c79

Please sign in to comment.