asynq icon indicating copy to clipboard operation
asynq copied to clipboard

Ineffectual error assignment in processor `perform` defer callback

Open khun84 opened this issue 1 year ago • 3 comments

If I read the code correctly, I think the error assignment in line 427 as well as line 429 are ineffectual as the err is later reassigned at line 431.

https://github.com/hibiken/asynq/blob/6a7bf2ceff1e920b3e8542635b273c4dcca192ac/processor.go#L426-L433

Am I missing anything here or its potentially a bug? 🤔

khun84 avatar Sep 20 '23 16:09 khun84

Thanks for reporting this. I think you are onto something here, It is definitely reassigned!

Pinging @linhbkhn95 on this.

potentially a bug?

I don't think so. The debug.Stack() message will still be more informative that the ones in the if else block. But good to fix such confusions. Though this change has not been released yet in any case.

kamikazechaser avatar Sep 20 '23 17:09 kamikazechaser

Thanks @khun84 for reporting this issue. good catch. It will not make potential bugs. But it makes it confusing. So, I will make a PR to improve it.

linhbkhn95 avatar Sep 22 '23 04:09 linhbkhn95

I just made PR to fix it https://github.com/hibiken/asynq/pull/758 @kamikazechaser Please review it

linhbkhn95 avatar Oct 08 '23 02:10 linhbkhn95