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:
parent
f9124c2864
commit
c2d60a1240
3 changed files with 4 additions and 4 deletions
|
|
@ -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,
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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()),
|
||||
}),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue