kucoin: replace UnixMilli

This commit is contained in:
c9s 2021-12-23 21:09:40 +08:00
parent e76dd1cbc4
commit d433c7f5b1
3 changed files with 5 additions and 5 deletions

View File

@ -74,7 +74,7 @@ var websocketCmd = &cobra.Command{
defer c.Close()
id := time.Now().UnixMilli()
id := time.Now().UnixNano() / int64(time.Millisecond)
wsCmds := []kucoin.WebSocketCommand{
/*
{
@ -125,7 +125,7 @@ var websocketCmd = &cobra.Command{
case <-pingTicker.C:
if err := c.WriteJSON(kucoin.WebSocketCommand{
Id: time.Now().UnixMilli(),
Id: time.Now().UnixNano() / int64(time.Millisecond),
Type: "ping",
}); err != nil {
logrus.WithError(err).Error("websocket ping error", err)

View File

@ -94,7 +94,7 @@ func toLocalInterval(i types.Interval) string {
// convertSubscriptions global subscription to local websocket command
func convertSubscriptions(ss []types.Subscription) ([]WebSocketCommand, error) {
var id = time.Now().UnixMilli()
var id = time.Now().UnixNano() / int64(time.Millisecond)
var cmds []WebSocketCommand
for _, s := range ss {
id++

View File

@ -137,7 +137,7 @@ func (s *Stream) handleConnect() {
return
}
} else {
id := time.Now().UnixMilli()
id := time.Now().UnixNano() / int64(time.Millisecond)
cmds := []WebSocketCommand{
{
Id: id,
@ -406,7 +406,7 @@ func ping(ctx context.Context, w WebSocketConnector, interval time.Duration) {
conn := w.Conn()
if err := conn.WriteJSON(WebSocketCommand{
Id: time.Now().UnixMilli(),
Id: time.Now().UnixNano() / int64(time.Millisecond),
Type: "ping",
}); err != nil {
log.WithError(err).Error("websocket ping error", err)