How to destroy jobs enqueued by resque workers?

前端 未结 7 1957
日久生厌
日久生厌 2021-01-30 05:22

I\'m using Resque on a rails-3 project to handle jobs that are scheduled to run every 5 minutes. I recently did something that snowballed the creation of these jobs and the stac

相关标签:
7条回答
  • 2021-01-30 06:06

    Enter redis console:

    redis-cli
    

    List databases:

    127.0.0.1:6379> KEYS *
     1) "resque:schedules_changed"
     2) "resque:workers"
     3) "resque:queue:your_overloaded_queue"
    

    "resque:queue:your_overloaded_queue" - db which you need.

    Then run:

    DEL resque:queue:your_overloaded_queue
    

    Or if you want to delete specified jobs in queue then list few values from db with LRANGE command:

    127.0.0.1:6379> LRANGE resque:queue:your_overloaded_queue 0 2
    1) "{\"class\":\"AppClass\",\"args\":[]}"
    2) "{\"class\":\"AppClass\",\"args\":[]}"
    3) "{\"class\":\"AppClass\",\"args\":[]}"
    

    Then copy/paste one value to LREM command:

    127.0.0.1:6379> LREM resque:queue:your_overloaded_queue 5 "{\"class\":\"AppClass\",\"args\":[]}"
    (integer) 5
    

    Where 5 - number of elements to remove.

    0 讨论(0)
提交回复
热议问题