dapr / dapr/go-sdk

PublishEvent option failed to set keys TTL

Open
#385 5 comments 2 reactions 0 assignees View on GitHub
bug
Dominant language
Go
Stars
479
Forks
187
PR merge metrics
No merged PRs in 30d

Description

**Describe the bug**
In use the PublishEvent function , I set the PublishEventOption :
`client.PublishEventWithMetadata(map[string]string{"ttlInseconds":"3600"})`
But when I check redis :
127.0.0.1:6379> TTL Stop
(integer) -1
clearly failed to set ttl , the value is -1 , but key store success.
And I don't see anything ttl unit test in client/pubsub_test.go

**To Reproduce**
redis docker version 6.2.5
go version 1.19
github.com/dapr/dapr v1.10.4
github.com/dapr/go-sdk v1.7.0

Hear's full codes:
`if err := d.daprClient.PublishEvent(ctx, "redis-pubsub", master.MethodType_Stop.String(), param,
client.PublishEventWithMetadata(map[string]string{"ttlInseconds": "3600"})); err != nil {
return err
}`

**Expected behavior**
1. If this is user mistake, please point where I was wrong.
2. fix this bug, pls

Contributor guide

Open the contributing guide

Research direction

Start in client/pubsub_test.go, which the report identifies as lacking TTL coverage, and trace PublishEventWithMetadata from there. Reproduce the example against Redis 6.2.5 and verify that the published key has a 3600-second TTL; done means the behavior is clarified or fixed and covered by a test.

Written by the indexing model from the issue text.

Assessment

Tech stack
go, redis
Domain
backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.