diff options
author | Maxence Lange <maxence@artificial-owl.com> | 2019-01-24 10:24:17 -0100 |
---|---|---|
committer | Julius Härtl <jus@bitgrid.net> | 2019-02-05 16:21:02 +0100 |
commit | c0f304cd5b2bb3baf0817babfe42153f34cdb9af (patch) | |
tree | 82ce862955699c142769e39a2221b9ad264952f7 /lib/Service | |
parent | 53b4137575a2e31522aa75e8921adcbcdd7bfd17 (diff) |
cleaning and renaming upsteam request caching
Signed-off-by: Maxence Lange <maxence@artificial-owl.com>
Diffstat (limited to 'lib/Service')
-rw-r--r-- | lib/Service/ActivityService.php | 32 | ||||
-rw-r--r-- | lib/Service/CurlService.php | 4 | ||||
-rw-r--r-- | lib/Service/RequestQueueService.php (renamed from lib/Service/QueueService.php) | 4 |
3 files changed, 20 insertions, 20 deletions
diff --git a/lib/Service/ActivityService.php b/lib/Service/ActivityService.php index d89c5195..7c8dbc93 100644 --- a/lib/Service/ActivityService.php +++ b/lib/Service/ActivityService.php @@ -76,8 +76,8 @@ class ActivityService { /** @var SignatureService */ private $signatureService; - /** @var QueueService */ - private $queueService; + /** @var RequestQueueService */ + private $requestQueueService; /** @var AccountService */ private $accountService; @@ -102,7 +102,7 @@ class ActivityService { * @param NotesRequest $notesRequest * @param FollowsRequest $followsRequest * @param SignatureService $signatureService - * @param QueueService $queueService + * @param RequestQueueService $requestQueueService * @param AccountService $accountService * @param CurlService $curlService * @param ConfigService $configService @@ -110,13 +110,13 @@ class ActivityService { */ public function __construct( NotesRequest $notesRequest, FollowsRequest $followsRequest, - SignatureService $signatureService, QueueService $queueService, + SignatureService $signatureService, RequestQueueService $requestQueueService, AccountService $accountService, CurlService $curlService, ConfigService $configService, MiscService $miscService ) { $this->notesRequest = $notesRequest; $this->followsRequest = $followsRequest; - $this->queueService = $queueService; + $this->requestQueueService = $requestQueueService; $this->accountService = $accountService; $this->signatureService = $signatureService; $this->curlService = $curlService; @@ -217,11 +217,11 @@ class ActivityService { $author = $this->getAuthorFromItem($activity); $instancePaths = $this->generateInstancePaths($activity); - $token = $this->queueService->generateRequestQueue($instancePaths, $activity, $author); + $token = $this->requestQueueService->generateRequestQueue($instancePaths, $activity, $author); $this->manageInit(); try { - $directRequest = $this->queueService->getPriorityRequest($token); + $directRequest = $this->requestQueueService->getPriorityRequest($token); $directRequest->setTimeout(self::TIMEOUT_LIVE); $this->manageRequest($directRequest); } catch (NoHighPriorityRequestException $e) { @@ -229,7 +229,7 @@ class ActivityService { return ''; } - $requests = $this->queueService->getRequestFromToken($token, RequestQueue::STATUS_STANDBY); + $requests = $this->requestQueueService->getRequestFromToken($token, RequestQueue::STATUS_STANDBY); if (sizeof($requests) > 0) { $this->curlService->asyncWithToken($token); } @@ -256,7 +256,7 @@ class ActivityService { } try { - $this->queueService->initRequest($queue); + $this->requestQueueService->initRequest($queue); } catch (QueueStatusException $e) { return; } @@ -266,24 +266,24 @@ class ActivityService { try { $this->signatureService->signRequest($request, $queue); $this->curlService->request($request); - $this->queueService->endRequest($queue, true); + $this->requestQueueService->endRequest($queue, true); } catch (RequestResultNotJsonException $e) { - $this->queueService->endRequest($queue, true); + $this->requestQueueService->endRequest($queue, true); } catch (ActorDoesNotExistException $e) { $this->miscService->log( 'Error while managing request: ' . json_encode($request) . ' ' . $e->getMessage(), 1 ); - $this->queueService->deleteRequest($queue); + $this->requestQueueService->deleteRequest($queue); } catch (RequestContentException $e) { $this->miscService->log( 'Error while managing request: ' . json_encode($request) . ' ' . $e->getMessage(), 1 ); - $this->queueService->deleteRequest($queue); + $this->requestQueueService->deleteRequest($queue); } catch (RequestResultSizeException $e) { $this->miscService->log( 'Error while managing request: ' . json_encode($request) . ' ' . $e->getMessage(), 1 ); - $this->queueService->deleteRequest($queue); + $this->requestQueueService->deleteRequest($queue); } catch (RequestServerException $e) { $this->miscService->log( 'Temporary error while managing request: RequestServerException - ' . json_encode( @@ -291,7 +291,7 @@ class ActivityService { ) . ' - ' . $e->getMessage(), 1 ); - $this->queueService->endRequest($queue, false); + $this->requestQueueService->endRequest($queue, false); $this->failInstances[] = $host; } catch (RequestNetworkException $e) { $this->miscService->log( @@ -299,7 +299,7 @@ class ActivityService { $request ) . ' - ' . $e->getMessage(), 1 ); - $this->queueService->endRequest($queue, false); + $this->requestQueueService->endRequest($queue, false); $this->failInstances[] = $host; } } diff --git a/lib/Service/CurlService.php b/lib/Service/CurlService.php index 923596d1..cc257464 100644 --- a/lib/Service/CurlService.php +++ b/lib/Service/CurlService.php @@ -57,7 +57,7 @@ class CurlService { use TPathTools; - const ASYNC_TOKEN = '/async/token/{token}'; + const ASYNC_REQUEST_TOKEN = '/async/request/{token}'; const USER_AGENT = 'Nextcloud Social'; @@ -237,7 +237,7 @@ class CurlService { $parse = parse_url($address); $host = $this->get('host', $parse, ''); $path = $this->withEndSlash($this->get('path', $parse, '')) . $this->withoutBeginSlash( - self::ASYNC_TOKEN + self::ASYNC_REQUEST_TOKEN ); $path = str_replace('{token}', $token, $path); diff --git a/lib/Service/QueueService.php b/lib/Service/RequestQueueService.php index b95f7415..ee5b1754 100644 --- a/lib/Service/QueueService.php +++ b/lib/Service/RequestQueueService.php @@ -41,7 +41,7 @@ use OCA\Social\Model\InstancePath; use OCA\Social\Model\RequestQueue; -class QueueService { +class RequestQueueService { use TArrayTools; @@ -58,7 +58,7 @@ class QueueService { /** - * QueueService constructor. + * RequestQueueService constructor. * * @param RequestQueueRequest $requestQueueRequest * @param ConfigService $configService |