move MXL retry policy to adapter
This commit is contained in:
@@ -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
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user