asynq icon indicating copy to clipboard operation
asynq copied to clipboard

[BUG] UNKNOWN: redis command error: SADD failed: redis: client is closed

Open linchao0815 opened this issue 2 years ago • 6 comments

Describe the bug client.Enqueue(task)

To Reproduce Steps to reproduce the behavior (Code snippets if applicable):

  1. Setup background processing ...
  2. Enqueue tasks ...
  3. See Error ...
  4. There is a low chance of this problem occurring.

How do I handle this error ?

linchao0815 avatar Oct 11 '22 07:10 linchao0815

I am getting the same thing

domgolonka avatar Oct 12 '22 18:10 domgolonka

@linchao0815 I figured it out, the asynq.Client was closing too early.

domgolonka avatar Oct 12 '22 22:10 domgolonka

@domgolonka

@linchao0815 I figured it out, the asynq.Client was closing too early. My case isn't it!

linchao0815 avatar Oct 13 '22 00:10 linchao0815

@linchao0815 I figured it out, the asynq.Client was closing too early.

Figure it out,Same situation, thanks

MetaverseMan avatar Apr 20 '23 17:04 MetaverseMan

How do you fix asynq.Client was closing too early ?

avvari-da avatar Apr 05 '24 20:04 avvari-da

How do you fix asynq.Client was closing too early ?

When you create the client you probably have added a defer function as shown in the example. This is called too early, eg. when the enclosing function returns. You could add the defer function to the main() function so the Task Client is not closed before your main function returns.

image

refuse2speak avatar Jul 07 '24 22:07 refuse2speak