Skip to content

Instantly share code, notes, and snippets.

@arturo-c
Last active August 29, 2015 14:05
Show Gist options
  • Save arturo-c/9f93f8bc4124be67098e to your computer and use it in GitHub Desktop.
Save arturo-c/9f93f8bc4124be67098e to your computer and use it in GitHub Desktop.
Allow queueing but not performing php resque
<?php
/**
* @file
* Contains Drupal\resque\PerformLockPlugin.
*/
namespace Drupal\resque;
use Resque as Php_Resque;
use Resque_Job_DontPerform;
class PerformLockPlugin{
function beforePerform($job) {
if (Php_Resque::redis()->exists($arguments['drupal_unique_key'])) {
throw new Resque_Job_DontPerform('Unique key conflict.');
$job->recreate();
}
}
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment