summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorMaxence Lange <maxence@artificial-owl.com>2018-12-12 10:19:30 -0100
committerGitHub <noreply@github.com>2018-12-12 10:19:30 -0100
commita7e644e7acbe813487d9ea3be82f8c3cfc08615d (patch)
treefcc4fd9b56a8ee998adaa2e4d2d29a2bfaf0312e /lib
parentd0e6a8b22085b7497daadb4afb0a18f7bce6d973 (diff)
parentdce5299325807a047553b33d70f888f6840d02ec (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.php22
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();
}