0

I'm using laravel notifications (https://laravel.com/docs/5.6/notifications) with redis queue. They all implement ShouldQueue but only some of them have to be delayed (reminders). However, when I delete object that is related to notification, I also need to delete all notifications related to object including the ones that are delayed. It is easy for the ones that are not delayed, since I can simply delete them from database, but the delayed are not on the database yet, they are still only in redis queue. Is there a way to delete delayed notifications from redis before it fires?

mgnjatovic
  • 11
  • 2
  • Instead of deleting the notifications that are no longer relevant, you can prevent them from actually sending by building in a check in the `via` method or via a `NotificationSending` listener. See this article: https://medium.com/@hotmeteor/handling-delayed-notifications-in-laravel-b6699ec30649 – Sygmoral Mar 02 '21 at 10:54

1 Answers1

0

When the queue is in redis then you cant do much the only option to delete it is through cli:

open cmd redis-cli then run FLUSHALL this will flush all the queue on memory from redis.

Leo
  • 7,274
  • 5
  • 26
  • 48
  • Thing is, I need to delete only one scheduled notification, and keep all of the others. Is it possible that there is no such options? – mgnjatovic Aug 24 '18 at 08:14
  • whats the operating system ? – Leo Aug 24 '18 at 08:15
  • I'm using latest homestead for dev environment, so ubuntu is on virtual machine, locally windows – mgnjatovic Aug 24 '18 at 08:17
  • no there is no way to delete a specific queue.sadly had this issue last week. please accept the answer. – Leo Aug 24 '18 at 13:46
  • I actually ended up moving delayed notifications to database queue. That way I was able to add model for that table, and delete specific record. If anyone have a solution how to do that for redis, I would very much like to hear it. – mgnjatovic Aug 27 '18 at 11:39