Add worker self-retire on terminal dial failure

This commit is contained in:
Jay
2026-06-06 19:41:45 -04:00
parent 1977fb385a
commit 7657de160e
3 changed files with 116 additions and 10 deletions
+5 -1
View File
@@ -219,7 +219,11 @@ func (w *DefaultWorker) runSession(ctx context.Context, pool PoolPlugin) {
ctx, retryMgr, w.dialFn, onError, w.handler,
)
if err != nil {
// TODO: cleanup worker? surface error?
if pool.Retire != nil &&
!errors.Is(err, context.Canceled) &&
!errors.Is(err, context.DeadlineExceeded) {
pool.Retire(err)
}
return
}