fix(publicip): no retry when too many requests to ipinfo.io
This commit is contained in:
@@ -2,10 +2,12 @@ package publicip
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"errors"
|
||||||
"os"
|
"os"
|
||||||
|
|
||||||
"github.com/qdm12/gluetun/internal/constants"
|
"github.com/qdm12/gluetun/internal/constants"
|
||||||
"github.com/qdm12/gluetun/internal/models"
|
"github.com/qdm12/gluetun/internal/models"
|
||||||
|
"github.com/qdm12/gluetun/internal/publicip/ipinfo"
|
||||||
)
|
)
|
||||||
|
|
||||||
func (l *Loop) Run(ctx context.Context, done chan<- struct{}) {
|
func (l *Loop) Run(ctx context.Context, done chan<- struct{}) {
|
||||||
@@ -80,6 +82,11 @@ func (l *Loop) Run(ctx context.Context, done chan<- struct{}) {
|
|||||||
}
|
}
|
||||||
l.statusManager.SetStatus(constants.Completed)
|
l.statusManager.SetStatus(constants.Completed)
|
||||||
case err := <-errorCh:
|
case err := <-errorCh:
|
||||||
|
if errors.Is(err, ipinfo.ErrTooManyRequests) {
|
||||||
|
l.logger.Warn(err.Error())
|
||||||
|
l.statusManager.SetStatus(constants.Crashed)
|
||||||
|
break
|
||||||
|
}
|
||||||
getCancel()
|
getCancel()
|
||||||
close(resultCh)
|
close(resultCh)
|
||||||
l.statusManager.SetStatus(constants.Crashed)
|
l.statusManager.SetStatus(constants.Crashed)
|
||||||
|
|||||||
Reference in New Issue
Block a user