move MXL retry policy to adapter

This commit is contained in:
Dmitry Sergeev
2026-08-27 09:12:17 +03:00
parent e19f02edbf
commit 4f6ee895e7
2 changed files with 5 additions and 4 deletions
+25
View File
@@ -0,0 +1,25 @@
package mxladapter
import (
"context"
"errors"
"mxl-player/internal/source"
)
// ShouldRetry reports whether an MXL source error should start another attempt.
func ShouldRetry(err error) bool {
if errors.Is(err, context.Canceled) {
return false
}
switch source.KindOf(err) {
case source.ErrorKindInvalidConfig:
return false
case source.ErrorKindTemporary,
source.ErrorKindUnavailable,
source.ErrorKindUnknown:
return true
default:
return true
}
}