mjphaynes / php-resque

php-resque is a Redis-backed PHP library for creating background jobs, placing them on multiple queues, and processing them later.
MIT License
222 stars 50 forks source link

TearDown... on exception #75

Closed merlindorin closed 4 years ago

merlindorin commented 6 years ago

Hi, I just saw the following piece of code in Job.php on the perform method :

            $instance = $this->getInstance();

            ob_start();

            if (method_exists($instance, 'setUp')) {
                $instance->setUp();
            }

            call_user_func_array(array($instance, $this->method), array($this->data, $this));

            if (method_exists($instance, 'tearDown')) {
                $instance->tearDown();
            }

            $this->complete();

From my point of view, tearDown should be execute in a 'finally' or for no php5.5+ in a catch.