Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

消息有延迟感,建议发送信息后, 立即显示在聊天窗口,后台判断是否发送成功。 #28

Open
ftlh2005 opened this issue May 13, 2022 · 4 comments

Comments

@ftlh2005
Copy link

消息有延迟感,建议发送信息后, 立即显示在聊天窗口,后台判断是否发送成功。
就像QQ 微信一样, 如果发送失败 显示

@gzydong
Copy link
Owner

gzydong commented May 13, 2022

好的,感谢您的建议

1 similar comment
@gzydong
Copy link
Owner

gzydong commented May 13, 2022

好的,感谢您的建议

@aohanhongzhi
Copy link

延迟得原因:我这里有一个情况是 auth鉴权的时候,使用redis,但是redis响应特别长。导致消息延迟或者发送失败。

@aohanhongzhi
Copy link

redis存在问题,可以通过增加心跳解决。
image

	//	https://github.com/redis/go-redis/issues/181
	ticker := time.NewTicker(time.Duration(55) * time.Second)
	//this is to send "ping" request each second for health-check
	go func() {
		for {
			select {
			case <-ticker.C:
				//send heart-beat signal to check if everything is ok
				if _, err := client.Ping(context.TODO()).Result(); err != nil {
					log.Errorf("unable to ping redis, error: %+v", err)
				} else {
					//log.Debug("heartbeat ok!")
				}
			}
		}
	}()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants