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() defer c.Close()
id := time.Now().UnixMilli() id := time.Now().UnixNano() / int64(time.Millisecond)
wsCmds := []kucoin.WebSocketCommand{ wsCmds := []kucoin.WebSocketCommand{
/* /*
{ {
@ -125,7 +125,7 @@ var websocketCmd = &cobra.Command{
case <-pingTicker.C: case <-pingTicker.C:
if err := c.WriteJSON(kucoin.WebSocketCommand{ if err := c.WriteJSON(kucoin.WebSocketCommand{
Id: time.Now().UnixMilli(), Id: time.Now().UnixNano() / int64(time.Millisecond),
Type: "ping", Type: "ping",
}); err != nil { }); err != nil {
logrus.WithError(err).Error("websocket ping error", err) 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 // convertSubscriptions global subscription to local websocket command
func convertSubscriptions(ss []types.Subscription) ([]WebSocketCommand, error) { func convertSubscriptions(ss []types.Subscription) ([]WebSocketCommand, error) {
var id = time.Now().UnixMilli() var id = time.Now().UnixNano() / int64(time.Millisecond)
var cmds []WebSocketCommand var cmds []WebSocketCommand
for _, s := range ss { for _, s := range ss {
id++ id++

View File

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