diff options
author | Maxence Lange <maxence@artificial-owl.com> | 2019-01-24 10:26:44 -0100 |
---|---|---|
committer | Maxence Lange <maxence@artificial-owl.com> | 2019-01-24 10:50:03 -0100 |
commit | accf7e424d23e8f343f4d0ecf053f65ab2800e77 (patch) | |
tree | 99e67d61c175b218a5c624e0f5eb74c0a827f102 /lib/Controller | |
parent | fd2ef9e6cec67b6a50b91293d97831d3631d9f26 (diff) |
implementing caching for incoming request
Signed-off-by: Maxence Lange <maxence@artificial-owl.com>
Diffstat (limited to 'lib/Controller')
-rw-r--r-- | lib/Controller/ActivityPubController.php | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/lib/Controller/ActivityPubController.php b/lib/Controller/ActivityPubController.php index e4915d45..0cab6d75 100644 --- a/lib/Controller/ActivityPubController.php +++ b/lib/Controller/ActivityPubController.php @@ -31,6 +31,8 @@ namespace OCA\Social\Controller; use daita\MySmallPhpTools\Traits\Nextcloud\TNCDataResponse; +use daita\MySmallPhpTools\Traits\TAsync; +use daita\MySmallPhpTools\Traits\TStringTools; use Exception; use OC\AppFramework\Http; use OCA\Social\AppInfo\Application; @@ -42,6 +44,7 @@ use OCA\Social\Service\FollowService; use OCA\Social\Service\ImportService; use OCA\Social\Service\MiscService; use OCA\Social\Service\SignatureService; +use OCA\Social\Service\StreamQueueService; use OCP\AppFramework\Controller; use OCP\AppFramework\Http\Response; use OCP\IRequest; @@ -51,6 +54,9 @@ class ActivityPubController extends Controller { use TNCDataResponse; + use TStringTools; + use TAsync; + /** @var SocialPubController */ @@ -62,6 +68,9 @@ class ActivityPubController extends Controller { /** @var SignatureService */ private $signatureService; + /** @var StreamQueueService */ + private $streamQueueService; + /** @var ImportService */ private $importService; @@ -79,6 +88,7 @@ class ActivityPubController extends Controller { * @param SocialPubController $socialPubController * @param CacheActorService $cacheActorService * @param SignatureService $signatureService + * @param StreamQueueService $streamQueueService * @param ImportService $importService * @param FollowService $followService * @param MiscService $miscService @@ -86,13 +96,15 @@ class ActivityPubController extends Controller { public function __construct( IRequest $request, SocialPubController $socialPubController, CacheActorService $cacheActorService, SignatureService $signatureService, - ImportService $importService, FollowService $followService, MiscService $miscService + StreamQueueService $streamQueueService, ImportService $importService, + FollowService $followService, MiscService $miscService ) { parent::__construct(Application::APP_NAME, $request); $this->socialPubController = $socialPubController; $this->cacheActorService = $cacheActorService; $this->signatureService = $signatureService; + $this->streamQueueService = $streamQueueService; $this->importService = $importService; $this->followService = $followService; $this->miscService = $miscService; @@ -178,7 +190,11 @@ class ActivityPubController extends Controller { } catch (ItemUnknownException $e) { } - return $this->success([]); + $this->async(); + $this->streamQueueService->cacheStreamByToken($activity->getRequestToken()); + + // or it will feed the logs. + exit(); } catch (SignatureIsGoneException $e) { return $this->fail($e, [], Http::STATUS_GONE, false); } catch (Exception $e) { |