()
| 250 | } |
| 251 | if !c.busy.CompareAndSwap(false, true) { |
| 252 | return errors.New("session_busy") |
| 253 | } |
| 254 | runCtx, cancel := context.WithCancel(ctx) |
| 255 | c.submitMu.Lock() |
| 256 | c.submitCancel = cancel |
| 257 | c.submitMu.Unlock() |
| 258 | go func() { |
| 259 | defer func() { |
| 260 | if recovered := recover(); recovered != nil { |
| 261 | c.emitStatus("error", map[string]any{"error": fmt.Sprintf("session panic: %v", recovered)}) |
| 262 | } |
| 263 | cancel() |
no test coverage detected