fix(relay): восстановление потоков при отказах turn и занятой квоте
This commit is contained in:
1 parent
e72157f4f7
commit
6570cd9dd7
12 files changed
+117
-12
No files matched your search
@@ -12,6 +12,7 @@ import (
|
||||
"github.com/samosvalishe/free-turn-proxy/internal/provider"
|
||||
"github.com/samosvalishe/free-turn-proxy/internal/proxy/allocpace"
|
||||
"github.com/samosvalishe/free-turn-proxy/internal/stats"
|
||||
"github.com/samosvalishe/free-turn-proxy/internal/transport/turndial"
|
||||
)
|
||||
|
||||
type fakeAuth struct {
|
||||
@@ -22,6 +23,15 @@ type fakeAuth struct {
|
||||
dropped atomic.Int32
|
||||
}
|
||||
|
||||
func TestRetryDelayAllocationQuota(t *testing.T) {
|
||||
for range 100 {
|
||||
delay := retryDelay(&fakeAuth{}, errors.Join(errors.New("allocate"), turndial.ErrAllocQuota))
|
||||
if delay < 15*time.Second || delay >= 30*time.Second {
|
||||
t.Fatalf("quota retry delay = %s", delay)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func (a *fakeAuth) IsAuthError(err error) bool {
|
||||
return a.authErr != nil && errors.Is(err, a.authErr)
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user