mirror of
https://github.com/TeaOSLab/EdgeAdmin.git
synced 2025-11-03 20:40:26 +08:00
修复在HTTP/1.x下开多个窗口访问非常慢的问题
This commit is contained in:
@@ -15,6 +15,9 @@ func (this *CheckAction) RunPost(params struct {
|
||||
HasError bool
|
||||
IsUpdated bool
|
||||
}) {
|
||||
var isStream = this.Request.ProtoMajor >= 2
|
||||
this.Data["isStream"] = isStream
|
||||
|
||||
var maxTries = 10
|
||||
for i := 0; i < maxTries; i++ {
|
||||
resp, err := this.RPC().NodeTaskRPC().ExistsNodeTasks(this.AdminContext(), &pb.ExistsNodeTasksRequest{
|
||||
@@ -26,7 +29,7 @@ func (this *CheckAction) RunPost(params struct {
|
||||
}
|
||||
|
||||
// 如果没有数据变化,继续查询
|
||||
if i < maxTries-1 && params.IsUpdated && resp.ExistTasks == params.IsDoing && resp.ExistError == params.HasError {
|
||||
if i < maxTries-1 && params.IsUpdated && resp.ExistTasks == params.IsDoing && resp.ExistError == params.HasError && isStream {
|
||||
time.Sleep(3 * time.Second)
|
||||
continue
|
||||
}
|
||||
|
||||
@@ -15,6 +15,9 @@ func (this *CheckAction) RunPost(params struct {
|
||||
HasError bool
|
||||
IsUpdated bool
|
||||
}) {
|
||||
var isStream = this.Request.ProtoMajor >= 2
|
||||
this.Data["isStream"] = isStream
|
||||
|
||||
var maxTries = 10
|
||||
for i := 0; i < maxTries; i++ {
|
||||
resp, err := this.RPC().DNSTaskRPC().ExistsDNSTasks(this.AdminContext(), &pb.ExistsDNSTasksRequest{})
|
||||
@@ -24,7 +27,7 @@ func (this *CheckAction) RunPost(params struct {
|
||||
}
|
||||
|
||||
// 如果没有数据变化,继续查询
|
||||
if i < maxTries-1 && params.IsUpdated && resp.ExistTasks == params.IsDoing && resp.ExistError == params.HasError {
|
||||
if i < maxTries-1 && params.IsUpdated && resp.ExistTasks == params.IsDoing && resp.ExistError == params.HasError && isStream {
|
||||
time.Sleep(3 * time.Second)
|
||||
continue
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user