Skip to content

Commit 38cc79e

Browse files
committed
refactor: improve logging clarity and testing robustness across modules
- Replace `m.Bytes()` with `m.Payload()` in log statements for better clarity Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
1 parent 68933cb commit 38cc79e

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

redis_test.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ func TestJobReachTimeout(t *testing.T) {
247247
for {
248248
select {
249249
case <-ctx.Done():
250-
log.Println("get data:", string(m.Bytes()))
250+
log.Println("get data:", string(m.Payload()))
251251
if errors.Is(ctx.Err(), context.Canceled) {
252252
log.Println("queue has been shutdown and cancel the job")
253253
} else if errors.Is(ctx.Err(), context.DeadlineExceeded) {
@@ -290,7 +290,7 @@ func TestCancelJobAfterShutdown(t *testing.T) {
290290
for {
291291
select {
292292
case <-ctx.Done():
293-
log.Println("get data:", string(m.Bytes()))
293+
log.Println("get data:", string(m.Payload()))
294294
if errors.Is(ctx.Err(), context.Canceled) {
295295
log.Println("queue has been shutdown and cancel the job")
296296
} else if errors.Is(ctx.Err(), context.DeadlineExceeded) {
@@ -333,15 +333,15 @@ func TestGoroutineLeak(t *testing.T) {
333333
for {
334334
select {
335335
case <-ctx.Done():
336-
log.Println("get data:", string(m.Bytes()))
336+
log.Println("get data:", string(m.Payload()))
337337
if errors.Is(ctx.Err(), context.Canceled) {
338338
log.Println("queue has been shutdown and cancel the job")
339339
} else if errors.Is(ctx.Err(), context.DeadlineExceeded) {
340340
log.Println("job deadline exceeded")
341341
}
342342
return nil
343343
default:
344-
log.Println("get data:", string(m.Bytes()))
344+
log.Println("get data:", string(m.Payload()))
345345
time.Sleep(50 * time.Millisecond)
346346
return nil
347347
}

0 commit comments

Comments
 (0)