Callback in task function?
Hi there,
First of all thanks for this plugin, I almost got it working in a project I'm working on. I'm following the example of your example-plugin and that works flawless with your dummy really_long_running_task in the task function:
public function really_long_running_task() {
return sleep( 5 );
}
However, I obviously want to place my own (memory heavy) function in there that uses the class Leafo\ScssPhp\Compiler.
But the result is not consistent, it never finishes the whole queue, while the data is pushed to the queue correctly.
My function with an exception handler looks something like this:
public function compileScss($value = null) {
$compiler = new Compiler();
$compiler->setFormatter('Leafo\ScssPhp\Formatter\Crunched');
try {
$style = $compiler->compile($value);
return $style;
} catch (\Exception $e) {
error_log($e);
}
}
There are no errors catched.
If I just return the $value (even with a sleep), it returns everything correctly.
How can I check if the function is done with one item, before passing the next one? Any help is appreciated!
Thank you!