1
0
Fork 0
mirror of https://github.com/eosswedenorg/thalos synced 2026-06-16 04:24:56 +02:00

api/redis/publisher.go: pass context as first parameter to NewPublisher()

This commit is contained in:
Henrik Hautakoski 2023-06-05 13:24:02 +02:00
parent f9124c2864
commit c2d60a1240
3 changed files with 4 additions and 4 deletions

View file

@ -14,10 +14,10 @@ type Publisher struct {
ns Namespace
}
func NewPublisher(client *redis.Client, ns Namespace) *Publisher {
func NewPublisher(ctx context.Context, client *redis.Client, ns Namespace) *Publisher {
return &Publisher{
pipeline: client.Pipeline(),
ctx: client.Context(),
ctx: ctx,
ns: ns,
}
}

View file

@ -12,7 +12,7 @@ import (
func TestPublisher_Write(t *testing.T) {
client, mock := redismock.NewClientMock()
pub := NewPublisher(client, Namespace{ChainID: "id"})
pub := NewPublisher(context.Background(), client, Namespace{ChainID: "id"})
mock.MatchExpectationsInOrder(true)
mock.ExpectPublish("ship::id::test", []byte("some string")).SetVal(0)

View file

@ -271,7 +271,7 @@ func main() {
processor := app.SpawnProccessor(
shClient,
api_redis.NewPublisher(rdb, api_redis.Namespace{
api_redis.NewPublisher(context.Background(), rdb, api_redis.Namespace{
Prefix: conf.Redis.Prefix,
ChainID: getChain(chainInfo.ChainID.String()),
}),