mirror of
https://github.com/eosswedenorg/thalos
synced 2026-07-03 11:53:41 +02:00
api/redis/publisher.go: pass context as first parameter to NewPublisher()
This commit is contained in:
parent
f9124c2864
commit
c2d60a1240
3 changed files with 4 additions and 4 deletions
|
|
@ -14,10 +14,10 @@ type Publisher struct {
|
||||||
ns Namespace
|
ns Namespace
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewPublisher(client *redis.Client, ns Namespace) *Publisher {
|
func NewPublisher(ctx context.Context, client *redis.Client, ns Namespace) *Publisher {
|
||||||
return &Publisher{
|
return &Publisher{
|
||||||
pipeline: client.Pipeline(),
|
pipeline: client.Pipeline(),
|
||||||
ctx: client.Context(),
|
ctx: ctx,
|
||||||
ns: ns,
|
ns: ns,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,7 @@ import (
|
||||||
func TestPublisher_Write(t *testing.T) {
|
func TestPublisher_Write(t *testing.T) {
|
||||||
client, mock := redismock.NewClientMock()
|
client, mock := redismock.NewClientMock()
|
||||||
|
|
||||||
pub := NewPublisher(client, Namespace{ChainID: "id"})
|
pub := NewPublisher(context.Background(), client, Namespace{ChainID: "id"})
|
||||||
|
|
||||||
mock.MatchExpectationsInOrder(true)
|
mock.MatchExpectationsInOrder(true)
|
||||||
mock.ExpectPublish("ship::id::test", []byte("some string")).SetVal(0)
|
mock.ExpectPublish("ship::id::test", []byte("some string")).SetVal(0)
|
||||||
|
|
|
||||||
|
|
@ -271,7 +271,7 @@ func main() {
|
||||||
|
|
||||||
processor := app.SpawnProccessor(
|
processor := app.SpawnProccessor(
|
||||||
shClient,
|
shClient,
|
||||||
api_redis.NewPublisher(rdb, api_redis.Namespace{
|
api_redis.NewPublisher(context.Background(), rdb, api_redis.Namespace{
|
||||||
Prefix: conf.Redis.Prefix,
|
Prefix: conf.Redis.Prefix,
|
||||||
ChainID: getChain(chainInfo.ChainID.String()),
|
ChainID: getChain(chainInfo.ChainID.String()),
|
||||||
}),
|
}),
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue