diff --git a/cmd/pkg/cli/debug_test.go b/cmd/pkg/cli/debug_test.go index fc850616..3c6f1cca 100644 --- a/cmd/pkg/cli/debug_test.go +++ b/cmd/pkg/cli/debug_test.go @@ -637,7 +637,7 @@ func TestDebugModel_Update(t *testing.T) { m.Update(tea.KeyMsg{Type: tea.KeyEnter}) data, _ := json.Marshal(types.InterfaceOf(payload)) - assert.Contains(t, m.View(), string(data)) + assert.Contains(t, m.View(), data) d.RemoveBreakpoint(d.Breakpoint()) }) @@ -700,7 +700,7 @@ func TestDebugModel_Update(t *testing.T) { m.Update(tea.KeyMsg{Type: tea.KeyEnter}) data := fmt.Sprintf("%v", types.InterfaceOf(payload)) - assert.Contains(t, m.View(), string(data)) + assert.Contains(t, m.View(), data) d.RemoveBreakpoint(d.Breakpoint()) }) @@ -763,7 +763,7 @@ func TestDebugModel_Update(t *testing.T) { m.Update(tea.KeyMsg{Type: tea.KeyEnter}) data := fmt.Sprintf("%v", types.InterfaceOf(payload)) - assert.Contains(t, m.View(), string(data)) + assert.Contains(t, m.View(), data) d.RemoveBreakpoint(d.Breakpoint()) }) diff --git a/ext/pkg/control/retry.go b/ext/pkg/control/retry.go index 4b3cc440..7ddbf334 100644 --- a/ext/pkg/control/retry.go +++ b/ext/pkg/control/retry.go @@ -9,7 +9,6 @@ import ( "github.com/siyul-park/uniflow/pkg/spec" "github.com/siyul-park/uniflow/pkg/types" "sync" - "sync/atomic" ) // RetryNodeSpec defines the configuration for RetryNode. @@ -102,19 +101,17 @@ func (n *RetryNode) forward(proc *process.Process) { return } - actual, _ := attempts.LoadOrStore(inPck, &atomic.Uint32{}) - count := actual.(*atomic.Uint32) - for { - v := count.Load() + actual, _ := attempts.LoadOrStore(inPck, 0) + count := actual.(int) - if int(v) == n.limit { + if count == n.limit { n.tracer.Transform(inPck, backPck) n.tracer.Write(errWriter, backPck) return } - if count.CompareAndSwap(v, v+1) { + if attempts.CompareAndSwap(inPck, count, count+1) { break } }