Skip to content

Commit

Permalink
fix ProcessPendingBundles record not found (#1444)
Browse files Browse the repository at this point in the history
  • Loading branch information
georgehao authored Jul 18, 2024
1 parent 3716c5a commit d516949
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
4 changes: 4 additions & 0 deletions rollup/internal/controller/relayer/l2_relayer.go
Original file line number Diff line number Diff line change
Expand Up @@ -505,10 +505,14 @@ func (r *Layer2Relayer) ProcessPendingBundles() {
r.metrics.rollupL2RelayerProcessPendingBundlesTotal.Inc()

bundle, err := r.bundleOrm.GetFirstPendingBundle(r.ctx)
if bundle == nil && err == nil {
return
}
if err != nil {
log.Error("Failed to fetch first pending L2 bundle", "err", err)
return
}

status := types.ProvingStatus(bundle.ProvingStatus)
switch status {
case types.ProvingTaskUnassigned, types.ProvingTaskAssigned:
Expand Down
3 changes: 3 additions & 0 deletions rollup/internal/orm/bundle.go
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,9 @@ func (o *Bundle) GetFirstPendingBundle(ctx context.Context) (*Bundle, error) {

var pendingBundle Bundle
if err := db.First(&pendingBundle).Error; err != nil {
if errors.Is(err, gorm.ErrRecordNotFound) {
return nil, nil
}
return nil, fmt.Errorf("Bundle.GetFirstPendingBundle error: %w", err)
}
return &pendingBundle, nil
Expand Down

0 comments on commit d516949

Please sign in to comment.