mirror of
https://github.com/TeaOSLab/EdgeAdmin.git
synced 2025-11-12 11:20:27 +08:00
修复在HTTP/1.x下开多个窗口访问非常慢的问题
This commit is contained in:
@@ -10,9 +10,9 @@ import (
|
||||
|
||||
// 启动IP库
|
||||
func (this *AdminNode) startIPLibrary() {
|
||||
logs.Println("NODE", "initializing ip library ...")
|
||||
logs.Println("[NODE]initializing ip library ...")
|
||||
err := iplibrary.InitDefault()
|
||||
if err != nil {
|
||||
logs.Println("NODE", "initialize ip library failed: "+err.Error())
|
||||
logs.Println("[NODE]initialize ip library failed: "+err.Error())
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
@@ -2312,7 +2312,9 @@ window.Tea.Action = function (action, params) {
|
||||
.then(function () {
|
||||
// console.log("done");
|
||||
if (typeof (_doneFn) == "function") {
|
||||
setTimeout(function () {
|
||||
_doneFn.call(Tea.Vue, {});
|
||||
})
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
@@ -117,6 +117,7 @@ Tea.context(function () {
|
||||
if (!Tea.Vue.teaCheckNodeTasks) {
|
||||
return
|
||||
}
|
||||
let isStream = false
|
||||
this.$post("/clusters/tasks/check")
|
||||
.params({
|
||||
isDoing: this.doingNodeTasks.isDoing ? 1 : 0,
|
||||
@@ -128,11 +129,12 @@ Tea.context(function () {
|
||||
this.doingNodeTasks.isDoing = resp.data.isDoing
|
||||
this.doingNodeTasks.hasError = resp.data.hasError
|
||||
this.doingNodeTasks.isUpdated = true
|
||||
isStream = resp.data.shouldWait
|
||||
})
|
||||
.done(function () {
|
||||
this.$delay(function () {
|
||||
this.loadNodeTasks()
|
||||
}, 5000)
|
||||
}, isStream ? 5000 : 30000)
|
||||
})
|
||||
}
|
||||
|
||||
@@ -156,6 +158,7 @@ Tea.context(function () {
|
||||
if (!Tea.Vue.teaCheckDNSTasks) {
|
||||
return
|
||||
}
|
||||
let isStream = false
|
||||
this.$post("/dns/tasks/check")
|
||||
.params({
|
||||
isDoing: this.doingDNSTasks.isDoing ? 1 : 0,
|
||||
@@ -167,11 +170,12 @@ Tea.context(function () {
|
||||
this.doingDNSTasks.isDoing = resp.data.isDoing
|
||||
this.doingDNSTasks.hasError = resp.data.hasError
|
||||
this.doingDNSTasks.isUpdated = true
|
||||
isStream = resp.data.isStream
|
||||
})
|
||||
.done(function () {
|
||||
this.$delay(function () {
|
||||
this.loadDNSTasks()
|
||||
}, 3000)
|
||||
}, isStream ? 5000 : 30000)
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
<form method="post" class="ui form" data-tea-action="$" data-tea-success="success">
|
||||
<table class="ui table definition selectable">
|
||||
<tr>
|
||||
<td>是否启用</td>
|
||||
<td>启用HTTP</td>
|
||||
<td>
|
||||
<div class="ui checkbox">
|
||||
<input type="checkbox" name="isOn" value="1" v-model="serverConfig.http.on"/>
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
<form method="post" data-tea-action="$" data-tea-success="success" class="ui form">
|
||||
<table class="ui table definition selectable">
|
||||
<tr>
|
||||
<td>是否启用</td>
|
||||
<td>启用HTTPS</td>
|
||||
<td>
|
||||
<div class="ui checkbox">
|
||||
<input type="checkbox" name="isOn" value="1" v-model="serverConfig.https.on"/>
|
||||
|
||||
Reference in New Issue
Block a user