diff options
author | Maxence Lange <maxence@artificial-owl.com> | 2018-12-12 10:19:30 -0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-12-12 10:19:30 -0100 |
commit | a7e644e7acbe813487d9ea3be82f8c3cfc08615d (patch) | |
tree | fcc4fd9b56a8ee998adaa2e4d2d29a2bfaf0312e /lib | |
parent | d0e6a8b22085b7497daadb4afb0a18f7bce6d973 (diff) | |
parent | dce5299325807a047553b33d70f888f6840d02ec (diff) |
Merge pull request #177 from nextcloud/async-only-if-valid-requests
Async the process only if there is request in STANDBY
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Controller/QueueController.php | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/lib/Controller/QueueController.php b/lib/Controller/QueueController.php index 3900eec5..4d32b12d 100644 --- a/lib/Controller/QueueController.php +++ b/lib/Controller/QueueController.php @@ -93,19 +93,21 @@ class QueueController extends Controller { * @param string $token */ public function asyncWithToken(string $token) { - $this->async(); - $requests = $this->queueService->getRequestFromToken($token, RequestQueue::STATUS_STANDBY); - $this->activityService->manageInit(); - foreach ($requests as $request) { - $request->setTimeout(ActivityService::TIMEOUT_ASYNC); - try { - $this->activityService->manageRequest($request); - } catch (RequestException $e) { - } catch (SocialAppConfigException $e) { + + if (!empty($requests)) { + $this->async(); + + $this->activityService->manageInit(); + foreach ($requests as $request) { + $request->setTimeout(ActivityService::TIMEOUT_ASYNC); + try { + $this->activityService->manageRequest($request); + } catch (RequestException $e) { + } catch (SocialAppConfigException $e) { + } } } - // or it will feed the logs. exit(); } |