Skip to content

Commit

Permalink
fix: use constant backoff algorithm
Browse files Browse the repository at this point in the history
If all devices are disconnected for a long time, sib will wait forever if exponential backoff algorithm is used.
  • Loading branch information
sam80180 committed Jan 27, 2024
1 parent 45aa1dc commit 0307e50
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/util/usbmux.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ func UsbmuxListen(cbOnData func(gidevice *giDevice.Device, device *entity.Device
mylatch := latch.NewCountDownLatch()
mylatch.Add(2)
go (func() {
backoffAlgorithm := backoff.NewExponentialBackOff()
backoffAlgorithm := backoff.NewConstantBackOff(30 * time.Second)
bIsOk := true
backoff.RetryNotify(func() error {
if mylatch.Counter() <= 0 {
Expand Down Expand Up @@ -59,7 +59,7 @@ func UsbmuxListen(cbOnData func(gidevice *giDevice.Device, device *entity.Device
logrus.Trace("end health check")
})()
go (func(funcStop *context.CancelFunc) {
backoffAlgorithm := backoff.NewExponentialBackOff()
backoffAlgorithm := backoff.NewConstantBackOff(30 * time.Second)
bIsOk := true
backoff.RetryNotify(func() error {
if mylatch.Counter() <= 1 { // 'read channel input' go routine is stopped
Expand Down

0 comments on commit 0307e50

Please sign in to comment.