Skip to content

Commit

Permalink
temp fix to chainreader error when no workflows (#15678)
Browse files Browse the repository at this point in the history
* temp fix to chainreader error when no workflows

* tidy
  • Loading branch information
ettec authored Dec 13, 2024
1 parent 38a9553 commit 19b122a
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions core/services/workflows/syncer/workflow_registry.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"encoding/json"
"fmt"
"iter"
"strings"
"sync"
"time"

Expand Down Expand Up @@ -222,8 +223,16 @@ func (w *workflowRegistry) Start(_ context.Context) error {
w.lggr.Debugw("Loading initial workflows for DON", "DON", don.ID)
loadWorkflowsHead, err := w.initialWorkflowsStateLoader.LoadWorkflows(ctx, don)
if err != nil {
w.lggr.Errorw("failed to load workflows", "err", err)
return
// TODO - this is a temporary fix to handle the case where the chainreader errors because the contract
// contains no workflows. To track: https://smartcontract-it.atlassian.net/browse/CAPPL-393
if !strings.Contains(err.Error(), "attempting to unmarshal an empty string while arguments are expected") {
w.lggr.Errorw("failed to load workflows", "err", err)
return
}

loadWorkflowsHead = &types.Head{
Height: "0",
}
}

reader, err := w.getContractReader(ctx)
Expand Down

0 comments on commit 19b122a

Please sign in to comment.