Skip to content

Commit 3b45357

Browse files
SignalR: invocation ID
1 parent cd408a7 commit 3b45357

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

tzkt/events/tzkt.go

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import (
44
"fmt"
55
"strings"
66
"sync"
7-
"time"
87

98
"github.com/dipdup-net/go-lib/tzkt/events/signalr"
109
log "github.com/sirupsen/logrus"
@@ -13,7 +12,7 @@ import (
1312
// TzKT - struct that used for connection to TzKT events server
1413
type TzKT struct {
1514
s *signalr.SignalR
16-
invokationID string
15+
invokationID int
1716

1817
subscriptions []signalr.Invocation
1918

@@ -29,7 +28,6 @@ func NewTzKT(url string) *TzKT {
2928
}
3029
return &TzKT{
3130
s: signalr.NewSignalR(url),
32-
invokationID: fmt.Sprintf("%d", time.Now().UnixNano()),
3331
msgs: make(chan Message),
3432
stop: make(chan struct{}),
3533
subscriptions: make([]signalr.Invocation, 0),
@@ -107,7 +105,8 @@ func (tzkt *TzKT) SubscribeToBigMaps(ptr *int64, contract, path string, tags ...
107105
}
108106

109107
func (tzkt *TzKT) subscribe(channel string, args ...interface{}) error {
110-
msg := signalr.NewInvocation(tzkt.invokationID, channel, args...)
108+
tzkt.invokationID += 1
109+
msg := signalr.NewInvocation(fmt.Sprintf("%d", tzkt.invokationID), channel, args...)
111110
tzkt.subscriptions = append(tzkt.subscriptions, msg)
112111
return tzkt.s.Send(msg)
113112
}

0 commit comments

Comments
 (0)