From aaa2b8f734e8a2f8cc4d57a8e8adfc2fe5da77d9 Mon Sep 17 00:00:00 2001
From: liuxiaolong <736321739@qq.com>
Date: 星期三, 13 五月 2020 11:50:34 +0800
Subject: [PATCH] rm ExecuteSql when recv UserEvent

---
 agent.go |   14 +++++++-------
 1 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/agent.go b/agent.go
index 45f9ab7..c3b488c 100644
--- a/agent.go
+++ b/agent.go
@@ -62,9 +62,9 @@
 }
 
 // Create create serf agent with config
-func Create(conf *Config) (*Agent, error) {
+func Create(conf *Config, snapshotPath string) (*Agent, error) {
 	// config cover to serf config
-	serfConf, err := conf.convertToSerf()
+	serfConf, err := conf.convertToSerf(snapshotPath)
 	if err != nil {
 		return nil, err
 	}
@@ -148,7 +148,7 @@
 				return
 			}
 			if sqlUe.Owner != a.conf.NodeName {
-				ExecuteWriteSql(sqlUe.Sql, true)
+				//ExecuteWriteSql(sqlUe.Sql, true)
 				//flag, _ := ExecuteSqlByGorm(sqlUe.Sql)
 				//fmt.Println("userEvent exec 1 ", sqlUe.Sql, ",Result:", results)
 				if receiveSqlInterface != nil && sqlUe.Sql !=nil && len(sqlUe.Sql) > 0 {
@@ -520,8 +520,8 @@
 }
 
 //Init serf Init
-func Init(clusterID string, password string, nodeID string, addrs []string) (*Agent, error) {
-	agent, err := InitNode(clusterID, password, nodeID)
+func Init(clusterID string, password string, nodeID string, addrs []string, snapshotPath string) (*Agent, error) {
+	agent, err := InitNode(clusterID, password, nodeID, snapshotPath)
 	if err != nil {
 		//fmt.Printf("InitNode failed, error: %s", err)
 		return agent, err
@@ -537,7 +537,7 @@
 }
 
 //InitNode web鍚庡彴鏀跺埌鍒涘缓闆嗙兢鐨勮姹傦紝
-func InitNode(clusterID string, password string, nodeID string) (*Agent, error) {
+func InitNode(clusterID string, password string, nodeID string, snapshotPath string) (*Agent, error) {
 	conf := DefaultConfig()
 	//fmt.Println("clusterID:", clusterID, "password:", password, "nodeID:", nodeID)
 	conf.ClusterID = clusterID
@@ -553,7 +553,7 @@
 		}
 		conf.EncryptKey = password
 	}
-	agent, err := Create(conf)
+	agent, err := Create(conf, snapshotPath)
 	if err != nil {
 		//fmt.Printf("create agent failed, error: %s", err)
 		return agent, err

--
Gitblit v1.8.0