Skip to content

Instantly share code, notes, and snippets.

@shaunlee
Last active March 2, 2016 10:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shaunlee/b946f8c7e2647d8df023 to your computer and use it in GitHub Desktop.
Save shaunlee/b946f8c7e2647d8df023 to your computer and use it in GitHub Desktop.
beanstalkd: clear tube
<?php
include 'pheanstalk/pheanstalk_init.php';
$ph = new Pheanstalk_Pheanstalk('127.0.0.1');
$ph->ignore('default')->watch($tube);
while ($job = $ph->reserve(0)) {
$ph->delete($job);
fwrite(STDOUT, $job->getId() . "\r");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment