mirror of
https://github.com/idanoo/php-resque
synced 2025-07-01 05:32:20 +00:00
Add setUp and tearDown callbacks for jobs
This commit is contained in:
parent
94fed1cfb4
commit
6e6d7ad859
6 changed files with 114 additions and 3 deletions
|
@ -129,8 +129,16 @@ class Resque_Job
|
|||
'Job class ' . $this->payload['class'] . ' does not contain a perform method.'
|
||||
);
|
||||
}
|
||||
|
||||
if(method_exists($this->payload['class'], 'setUp')) {
|
||||
call_user_func(array($this->payload['class'], 'setUp'), $this->payload['args']);
|
||||
}
|
||||
|
||||
call_user_func(array($this->payload['class'], 'perform'), $this->payload['args']);
|
||||
|
||||
if(method_exists($this->payload['class'], 'tearDown')) {
|
||||
call_user_func(array($this->payload['class'], 'tearDown'), $this->payload['args']);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue