Browse Source

修改Bug

yjp 3 years ago
parent
commit
b0af35fa75
1 changed files with 7 additions and 5 deletions
  1. 7 5
      dapr.go

+ 7 - 5
dapr.go

@@ -14,12 +14,14 @@ func DestroyDAPR() {
 }
 
 func GetInstance() *Client {
-	client, err := newClient(clientTimeoutSec)
-	if err != nil {
-		panic(err)
-	}
+	if clientInstance == nil {
+		client, err := newClient(clientTimeoutSec)
+		if err != nil {
+			panic(err)
+		}
 
-	clientInstance = client
+		clientInstance = client
+	}
 
 	return clientInstance
 }