fix: client unexpected timeout (#1239)
* fix: client unexpected timeout Signed-off-by: Jim Ma <majinjing3@gmail.com>
This commit is contained in:
parent
3ccf3ae929
commit
1f79e76a4b
|
|
@ -45,9 +45,10 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
//reasonContextCanceled = "context canceled"
|
// TODO implement peer task health check
|
||||||
|
// reasonContextCanceled = "context canceled"
|
||||||
|
// reasonReScheduleTimeout = "wait more available peers from scheduler timeout"
|
||||||
reasonScheduleTimeout = "wait first peer packet from scheduler timeout"
|
reasonScheduleTimeout = "wait first peer packet from scheduler timeout"
|
||||||
reasonReScheduleTimeout = "wait more available peers from scheduler timeout"
|
|
||||||
reasonPeerGoneFromScheduler = "scheduler says client should disconnect"
|
reasonPeerGoneFromScheduler = "scheduler says client should disconnect"
|
||||||
reasonBackSourceDisabled = "download from source disabled"
|
reasonBackSourceDisabled = "download from source disabled"
|
||||||
|
|
||||||
|
|
@ -925,18 +926,6 @@ func (pt *peerTaskConductor) waitAvailablePeerPacket() (int32, bool) {
|
||||||
pt.span.AddEvent("back source due to scheduler says need back source ")
|
pt.span.AddEvent("back source due to scheduler says need back source ")
|
||||||
// TODO optimize back source when already downloaded some pieces
|
// TODO optimize back source when already downloaded some pieces
|
||||||
pt.backSource()
|
pt.backSource()
|
||||||
case <-time.After(pt.schedulerOption.ScheduleTimeout.Duration):
|
|
||||||
if pt.schedulerOption.DisableAutoBackSource {
|
|
||||||
pt.cancel(base.Code_ClientScheduleTimeout, reasonBackSourceDisabled)
|
|
||||||
err := fmt.Errorf("%s, auto back source disabled", pt.failedReason)
|
|
||||||
pt.span.RecordError(err)
|
|
||||||
pt.Errorf(err.Error())
|
|
||||||
} else {
|
|
||||||
pt.Warnf("start download from source due to %s", reasonReScheduleTimeout)
|
|
||||||
pt.span.AddEvent("back source due to schedule timeout")
|
|
||||||
pt.needBackSource.Store(true)
|
|
||||||
pt.backSource()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return -1, false
|
return -1, false
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue