Skip to content

Commit 5461ddb

Browse files
committed
refactor: refactor job type handling and improve test reliability
- Refactor job type assertion and JSON unmarshalling logic in the main function Signed-off-by: Bo-Yi Wu <[email protected]>
1 parent b64c331 commit 5461ddb

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

README.md

+3-5
Original file line numberDiff line numberDiff line change
@@ -64,11 +64,9 @@ func main() {
6464
redisdb.WithAddr("127.0.0.1:6379"),
6565
redisdb.WithChannel("foobar"),
6666
redisdb.WithRunFunc(func(ctx context.Context, m queue.TaskMessage) error {
67-
v, ok := m.(*job)
68-
if !ok {
69-
if err := json.Unmarshal(m.Bytes(), &v); err != nil {
70-
return err
71-
}
67+
var v job
68+
if err := json.Unmarshal(m.Payload(), &v); err != nil {
69+
return err
7270
}
7371

7472
rets <- v.Message

0 commit comments

Comments
 (0)