Skip to content

Make queue works with connection_pool #176

Closed
@0x501D

Description

@0x501D

For now we cannot work with queue on replicaset setups:

package main

import (
    "fmt"
    "time"

    "github.com/tarantool/go-tarantool"
    "github.com/tarantool/go-tarantool/connection_pool"
    "github.com/tarantool/go-tarantool/queue"
)

func main() {
    replicaset, err := connection_pool.Connect([]string{"127.0.0.1:3301", "127.0.0.1:3302"}, tarantool.Opts{
        Timeout: 500 * time.Millisecond,
    })
    if err != nil {
        fmt.Printf("error in connect is %v", err)
    }
    
    defer replicaset.Close()
    
    q := queue.New(replicaset, "test_tube_tmp2")
    stat, err := q.Statistic()
    fmt.Println(stat)
}

This code will fails:

$ go run test.go
# command-line-arguments
./test.go:25:17: cannot use replicaset (variable of type *connection_pool.ConnectionPool) as type tarantool.Connector in argument to queue.New:
	*connection_pool.ConnectionPool does not implement tarantool.Connector (wrong type for Call method)
		have Call(functionName string, args interface{}, userMode connection_pool.Mode) (resp *tarantool.Response, err error)
		want Call(functionName string, args interface{}) (resp *tarantool.Response, err error)

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions