How can I get a list of all jobs in a beanstalk tube?

馋奶兔 提交于 2019-11-27 14:41:33

问题


I have beanstalk installed on my server, and run the following:

$ telnet localhost 11300
use my_tube
USING my_tube
peek-ready
FOUND 11065 41
{"ts":1295537419,"data":{"nid":"212156"}}

Now my question is: how can I get a list of all jobs in the queue; something like peek-all?


回答1:


There are some forks of the main code that provide this sort of information (retrieving ready, reserved, and buried jobs in a tube), but its not in the main trunk version. This is because of the problems that it can bring - such as on a huge implementation it would have to return a potentially vast amount of data and block the server from doing any other work in the meantime.

Ultimately, BeanstalkD is a queue - not an array, and not designed to allow access to every item within it - it returns the next item to work on.

Thinking of the problem from another direction may be useful - such as asking why you need the information about the contents of the queue, and possibly assembling the data you would need as items are being added, by your own code.



来源:https://stackoverflow.com/questions/4772770/how-can-i-get-a-list-of-all-jobs-in-a-beanstalk-tube

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!