From 3faa45c4b2214c9119cc9bb6570be38a5848fa1e Mon Sep 17 00:00:00 2001 From: Francesco Giannelli Date: Mon, 27 Jul 2015 08:01:29 +0200 Subject: [PATCH] allow to stop the execution if a callback returns a flag I am not sure if it works?? --- src/RollingCurl/RollingCurl.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/RollingCurl/RollingCurl.php b/src/RollingCurl/RollingCurl.php index bdd8f4c..6811097 100644 --- a/src/RollingCurl/RollingCurl.php +++ b/src/RollingCurl/RollingCurl.php @@ -275,8 +275,13 @@ public function execute() // if there is a callback, run it if (is_callable($this->callback)) { $callback = $this->callback; - $callback($request, $this); + $return = $callback($request, $this); } + if($return == 'stop') { + curl_multi_close($master); + return; + } + // if something was requeued, this will get it running/update our loop check values $status = curl_multi_exec($master, $active);