How to deal with redis while developing applications using bullmq #2303
-
Hello friends, I am developing a sveltekit-based web application and using Bullmq for some background processes. I have used patterns to repeat the process every day at a certain time.
Thanks |
Beta Was this translation helpful? Give feedback.
Replies: 5 comments 9 replies
-
In general restarting the app will not induce a repeatable job to be processed. We will need more context to understand why you are getting this behaviour. |
Beta Was this translation helpful? Give feedback.
-
Actually, that's what I am looking for since I am testing my application, I need to remove previous schedules since I put the new pattern for the next text of my code, but currently on a rerun of the program, the background process will get executed before the scheduled time, I am suspecting that the previous queue won't be removed as rerun the program. But I am still new to how Bullmq and Redis communicate. |
Beta Was this translation helpful? Give feedback.
-
@manast any suggestions? |
Beta Was this translation helpful? Give feedback.
-
@roggervalf ok that is good info, I will do that. But just one last question on production does redis self clean it self or is there any mechanism to prevent redis to consume much RAM or go nuts and break my app. |
Beta Was this translation helpful? Give feedback.
-
Yeah but while I was locally testing my application with bullmq, if the job didn't exected based on the schedule window, on the next restart of the application, all unexecuted jobs will run even before their scheduled time. Therefore I wanted to this behaviour in my application. Like clearing Redis cache at each start of my application. This is the way I understand how bullmq schedule works with Redis, when my application starts and set the scheduled time, that value will be saved on Redis as key and value. In case, my application goes down before the scheduled time for the jobs and starts up after the scheduled time, I see the jobs running instantly and the next repeated job will be run on the scheduled time. I do not understand the relationship between Bullmq and Redis. How to handle the repeatable jobs. Thank you |
Beta Was this translation helpful? Give feedback.
If you want to clean redis just issue a flushall command (https://redis.io/commands/flushall/). In production you will for sure not want to clean redis everytime a server is restarted...