You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@rocketmq.apache.org by di...@apache.org on 2022/03/09 06:08:46 UTC

[rocketmq-client-go] branch master updated: [Issue #778] Build instance name with nanosecond (#779)

This is an automated email from the ASF dual-hosted git repository.

dinglei pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/rocketmq-client-go.git


The following commit(s) were added to refs/heads/master by this push:
     new 13e4bd6  [Issue #778] Build instance name with nanosecond (#779)
13e4bd6 is described below

commit 13e4bd60ee724dfd0efb8dae002cdc58ed09e34e
Author: chaiyx <ch...@163.com>
AuthorDate: Wed Mar 9 14:08:13 2022 +0800

    [Issue #778] Build instance name with nanosecond (#779)
    
    [Issue #778] Build instance name with nanosecond (#779)
---
 internal/client.go | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/internal/client.go b/internal/client.go
index 35a88a4..4d7769e 100644
--- a/internal/client.go
+++ b/internal/client.go
@@ -119,7 +119,7 @@ type ClientOptions struct {
 
 func (opt *ClientOptions) ChangeInstanceNameToPID() {
 	if opt.InstanceName == "DEFAULT" {
-		opt.InstanceName = strconv.Itoa(os.Getpid())
+		opt.InstanceName = fmt.Sprintf("%d#%d", os.Getpid(), time.Now().UnixNano())
 	}
 }