(runID uuid.UUID, stepNumber int32)
| 169 | } |
| 170 | |
| 171 | func syncStepCounter(runID uuid.UUID, stepNumber int32) { |
| 172 | val, _ := stepCounters.LoadOrStore(runID, &atomic.Int32{}) |
| 173 | counter, ok := val.(*atomic.Int32) |
| 174 | if !ok { |
| 175 | panic("chatdebug: invalid step counter type") |
| 176 | } |
| 177 | for { |
| 178 | current := counter.Load() |
| 179 | if current >= stepNumber { |
| 180 | return |
| 181 | } |
| 182 | if counter.CompareAndSwap(current, stepNumber) { |
| 183 | return |
| 184 | } |
| 185 | } |
| 186 | } |
| 187 | |
| 188 | type stepHandle struct { |
| 189 | stepCtx *StepContext |