-
Notifications
You must be signed in to change notification settings - Fork 135
/
Copy pathtimeouter.go
36 lines (27 loc) · 923 Bytes
/
timeouter.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
package ton
import (
"context"
"time"
"github.com/xssnick/tonutils-go/tl"
)
type timeoutClient struct {
original LiteClient
timeout time.Duration
}
func (c *timeoutClient) QueryLiteserver(ctx context.Context, payload tl.Serializable, result tl.Serializable) error {
tCtx, cancel := context.WithTimeout(ctx, c.timeout)
defer cancel()
return c.original.QueryLiteserver(tCtx, payload, result)
}
func (c *timeoutClient) StickyContext(ctx context.Context) context.Context {
return c.original.StickyContext(ctx)
}
func (c *timeoutClient) StickyNodeID(ctx context.Context) uint32 {
return c.original.StickyNodeID(ctx)
}
func (w *timeoutClient) StickyContextExcludeNode(ctx context.Context) (context.Context, error) {
return w.original.StickyContextExcludeNode(ctx)
}
func (c *timeoutClient) StickyContextNextNode(ctx context.Context) (context.Context, error) {
return c.original.StickyContextNextNode(ctx)
}