move MXL retry policy to adapter
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
package playback
|
package mxladapter
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
@@ -6,7 +6,8 @@ import (
|
|||||||
"mxl-player/internal/source"
|
"mxl-player/internal/source"
|
||||||
)
|
)
|
||||||
|
|
||||||
func shouldRetrySourceError(err error) bool {
|
// ShouldRetry reports whether an MXL source error should start another attempt.
|
||||||
|
func ShouldRetry(err error) bool {
|
||||||
if errors.Is(err, context.Canceled) {
|
if errors.Is(err, context.Canceled) {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package playback
|
package mxladapter
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
@@ -66,7 +66,7 @@ func TestShouldRetrySourceError(t *testing.T) {
|
|||||||
|
|
||||||
for _, tt := range tests {
|
for _, tt := range tests {
|
||||||
t.Run(tt.name, func(t *testing.T) {
|
t.Run(tt.name, func(t *testing.T) {
|
||||||
if got := shouldRetrySourceError(tt.err); got != tt.want {
|
if got := ShouldRetry(tt.err); got != tt.want {
|
||||||
t.Errorf("shouldRetrySourceError() = %t, want %t", got, tt.want)
|
t.Errorf("shouldRetrySourceError() = %t, want %t", got, tt.want)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
Reference in New Issue
Block a user