Skip to content

Commit 114dbea

Browse files
author
Alexey Andreev
committed
added CallAsyncNoReturn method
1 parent fd70ed8 commit 114dbea

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

tarantool.go

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,23 @@ func init() {
99
modules.Register("k6/x/tarantool", new(Tarantool))
1010
}
1111

12+
var (
13+
chCallFutures = make(chan *tarantool.Future, 4096)
14+
)
15+
1216
// Tarantool is the k6 Tarantool extension
1317
type Tarantool struct{}
1418

19+
func (Tarantool) ResolveCallFutures() {
20+
go func() {
21+
for fut := range chCallFutures {
22+
if _, err := fut.Get(); err != nil {
23+
panic(err)
24+
}
25+
}
26+
}()
27+
}
28+
1529
// Connect creates a new Tarantool connection
1630
func (Tarantool) Connect(addr string, opts tarantool.Opts) (*tarantool.Connection, error) {
1731
if addr == "" {
@@ -87,6 +101,10 @@ func (Tarantool) Call(conn *tarantool.Connection, fnName string, args interface{
87101
return resp, err
88102
}
89103

104+
func (Tarantool) CallAsyncNoReturn(conn *tarantool.Connection, fnName string, args interface{}) {
105+
chCallFutures <- conn.CallAsync(fnName, args)
106+
}
107+
90108
// Call17 calls registered tarantool function
91109
func (Tarantool) Call17(conn *tarantool.Connection, fnName string, args interface{}) (*tarantool.Response, error) {
92110
resp, err := conn.Call17(fnName, args)

0 commit comments

Comments
 (0)