fix(delivery): 将第一平台发货出站超时调到 30 秒
常态提交约 11 秒,15 秒上限会在上游偶发变慢时提前断开,可能把仍在处理的订单记成失败。 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -29,6 +29,8 @@ const (
|
||||
deliveryStageCreateOrder = "create_upstream" // 创建上游正式订单失败
|
||||
|
||||
deliverySubmissionStaleTimeout = 10 * time.Minute
|
||||
// 第一平台创建正式订单常态约 11 秒,15 秒上限会在偶发变慢时提前断开。
|
||||
deliveryUpstreamTimeout = 30 * time.Second
|
||||
)
|
||||
|
||||
// deliverySubmittedUpstream 判断订单是否已成功提交到上游正式订单。
|
||||
@@ -79,7 +81,7 @@ func NewDeliveryService(fulfillment *FulfillmentService, bffBaseURL, channel, li
|
||||
if linkTTLMinutes < 0 {
|
||||
linkTTLMinutes = 0
|
||||
}
|
||||
client := &http.Client{Timeout: 15 * time.Second}
|
||||
client := &http.Client{Timeout: deliveryUpstreamTimeout}
|
||||
dlc := NewDLCProvider(bffBaseURL, channel, client)
|
||||
router := NewFulfillmentRouter(dlc)
|
||||
return &DeliveryService{
|
||||
|
||||
@@ -41,7 +41,7 @@ func NewDLCProvider(bffBaseURL, channel string, httpClient *http.Client) *DLCPro
|
||||
channel = "dlc"
|
||||
}
|
||||
if httpClient == nil {
|
||||
httpClient = &http.Client{Timeout: 15 * timeSecond(15)}
|
||||
httpClient = &http.Client{Timeout: deliveryUpstreamTimeout}
|
||||
}
|
||||
return &DLCProvider{
|
||||
bffBaseURL: bffBaseURL,
|
||||
@@ -633,6 +633,3 @@ func (p *DLCProvider) signProxy(path, method string, data interface{}, out inter
|
||||
return lastErr
|
||||
}
|
||||
|
||||
func timeSecond(s int) time.Duration {
|
||||
return time.Duration(s) * time.Second
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user