优化代码

This commit is contained in:
GoEdgeLab
2022-03-25 14:11:34 +08:00
parent 69e62acfab
commit ba125aab9e
5 changed files with 28 additions and 4 deletions

View File

@@ -333,6 +333,21 @@ func (this *Node) loop() error {
goman.New(func() { goman.New(func() {
sharedUpgradeManager.Start() sharedUpgradeManager.Start()
}) })
case "scriptsChanged":
err = this.reloadCommonScripts()
if err != nil {
return errors.New("reload common scripts failed: " + err.Error())
}
// 修改为已同步
_, err = rpcClient.NodeTaskRPC().ReportNodeTaskDone(nodeCtx, &pb.ReportNodeTaskDoneRequest{
NodeTaskId: task.Id,
IsOk: true,
Error: "",
})
if err != nil {
return err
}
} }
} }

View File

@@ -0,0 +1,9 @@
// Copyright 2022 Liuxiangchao iwind.liu@gmail.com. All rights reserved.
//go:build community
// +build community
package nodes
func (this *Node) reloadCommonScripts() error {
return nil
}

View File

@@ -60,7 +60,7 @@ func (this *OCSPUpdateTask) Loop() error {
return err return err
} }
resp, err := rpcClient.SSLCertService().ListUpdatedSSLCertOCSP(rpcClient.Context(), &pb.ListUpdatedSSLCertOCSPRequest{ resp, err := rpcClient.SSLCertRPC().ListUpdatedSSLCertOCSP(rpcClient.Context(), &pb.ListUpdatedSSLCertOCSPRequest{
Version: this.version, Version: this.version,
Size: 100, Size: 100,
}) })

View File

@@ -135,11 +135,11 @@ func (this *RPCClient) MetricStatRPC() pb.MetricStatServiceClient {
return pb.NewMetricStatServiceClient(this.pickConn()) return pb.NewMetricStatServiceClient(this.pickConn())
} }
func (this *RPCClient) FirewallService() pb.FirewallServiceClient { func (this *RPCClient) FirewallRPC() pb.FirewallServiceClient {
return pb.NewFirewallServiceClient(this.pickConn()) return pb.NewFirewallServiceClient(this.pickConn())
} }
func (this *RPCClient) SSLCertService() pb.SSLCertServiceClient { func (this *RPCClient) SSLCertRPC() pb.SSLCertServiceClient {
return pb.NewSSLCertServiceClient(this.pickConn()) return pb.NewSSLCertServiceClient(this.pickConn())
} }

View File

@@ -34,7 +34,7 @@ func init() {
} }
for task := range notifyChan { for task := range notifyChan {
_, err = rpcClient.FirewallService().NotifyHTTPFirewallEvent(rpcClient.Context(), &pb.NotifyHTTPFirewallEventRequest{ _, err = rpcClient.FirewallRPC().NotifyHTTPFirewallEvent(rpcClient.Context(), &pb.NotifyHTTPFirewallEventRequest{
ServerId: task.ServerId, ServerId: task.ServerId,
HttpFirewallPolicyId: task.HttpFirewallPolicyId, HttpFirewallPolicyId: task.HttpFirewallPolicyId,
HttpFirewallRuleGroupId: task.HttpFirewallRuleGroupId, HttpFirewallRuleGroupId: task.HttpFirewallRuleGroupId,