eventWrapperService = $eventWrapperService; $this->federatedEventService = $federatedEventService; $this->remoteUpstreamService = $remoteUpstreamService; $this->remoteDownstreamService = $remoteDownstreamService; $this->configService = $configService; $this->setup('app', Application::APP_ID); $this->setupInt(self::$SETUP_TIME_LIMIT, 900); } /** * Called locally. * * Async process and broadcast the event to every instances of GS * This should be initiated by the instance that owns the Circles. * * @PublicPage * @NoCSRFRequired * * @param string $token * * @return DataResponse */ public function asyncBroadcast(string $token): DataResponse { $wrappers = $this->remoteUpstreamService->getEventsByToken($token); if (empty($wrappers) && $token !== 'test-dummy-token') { return new DataResponse([], Http::STATUS_OK); } if ($token === 'test-dummy-token' && $this->appConfig->getValueInt(Application::APP_ID, 'test_dummy_token') < time()) { return new DataResponse([], Http::STATUS_UNAUTHORIZED); } // closing socket, keep current process running. $this->async(); foreach ($wrappers as $wrapper) { $this->eventWrapperService->manageWrapper($wrapper); } $this->eventWrapperService->confirmStatus($token); // so circles:check can check async is fine if ($token === 'test-dummy-token') { sleep(4); } // exit() or useless log will be generated exit(); } }