mirror of
https://github.com/TeaOSLab/EdgeNode.git
synced 2026-01-02 12:06:35 +08:00
优化代码
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package nodes
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs"
|
||||
"runtime"
|
||||
"testing"
|
||||
@@ -43,7 +44,7 @@ func TestHTTPClientPool_cleanClients(t *testing.T) {
|
||||
Version: 2,
|
||||
Addr: &serverconfigs.NetworkAddressConfig{Host: "127.0.0.1", PortRange: "1234"},
|
||||
}
|
||||
err := origin.Init(nil)
|
||||
err := origin.Init(context.Background())
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
@@ -65,7 +66,7 @@ func BenchmarkHTTPClientPool_Client(b *testing.B) {
|
||||
Version: 2,
|
||||
Addr: &serverconfigs.NetworkAddressConfig{Host: "127.0.0.1", PortRange: "1234"},
|
||||
}
|
||||
err := origin.Init(nil)
|
||||
err := origin.Init(context.Background())
|
||||
if err != nil {
|
||||
b.Fatal(err)
|
||||
}
|
||||
|
||||
@@ -95,7 +95,7 @@ func (this *HTTPRequest) doRoot() (isBreak bool) {
|
||||
}
|
||||
|
||||
var filename = strings.Replace(requestPath, "/", Tea.DS, -1)
|
||||
var filePath = ""
|
||||
var filePath string
|
||||
if len(filename) > 0 && filename[0:1] == Tea.DS {
|
||||
filePath = rootDir + filename
|
||||
} else {
|
||||
|
||||
@@ -2,6 +2,7 @@ package nodes
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"context"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"github.com/TeaOSLab/EdgeCommon/pkg/configutils"
|
||||
@@ -194,7 +195,7 @@ func (this *Node) Start() {
|
||||
}
|
||||
teaconst.NodeId = nodeConfig.Id
|
||||
teaconst.NodeIdString = types.String(teaconst.NodeId)
|
||||
err, serverErrors := nodeConfig.Init(nil)
|
||||
err, serverErrors := nodeConfig.Init(context.Background())
|
||||
if err != nil {
|
||||
remotelogs.Error("NODE", "init node config failed: "+err.Error())
|
||||
return
|
||||
@@ -391,7 +392,7 @@ func (this *Node) syncConfig(taskVersion int64) error {
|
||||
return err
|
||||
}
|
||||
|
||||
err, serverErrors := nodeConfig.Init(nil)
|
||||
err, serverErrors := nodeConfig.Init(context.Background())
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -1034,7 +1035,7 @@ func (this *Node) reloadServer() {
|
||||
remotelogs.Debug("NODE", "reload "+types.String(countUpdatingServers)+" servers")
|
||||
}
|
||||
|
||||
err, serverErrors := newNodeConfig.Init(nil)
|
||||
err, serverErrors := newNodeConfig.Init(context.Background())
|
||||
if err != nil {
|
||||
remotelogs.Error("NODE", "apply server config error: "+err.Error())
|
||||
return
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
// Copyright 2021 Liuxiangchao iwind.liu@gmail.com. All rights reserved.
|
||||
//go:build arm64
|
||||
// +build arm64
|
||||
|
||||
package nodes
|
||||
|
||||
// 处理异常
|
||||
func (this *Node) handlePanic() {
|
||||
return
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user