Signed-off-by: Carl Schwan <carl@carlschwan.eu>
pull/1500/head
Carl Schwan 2022-10-28 10:39:18 +02:00
rodzic 60f7ce31bb
commit 1e4a9f2cab
3 zmienionych plików z 9 dodań i 29 usunięć

Wyświetl plik

@ -154,7 +154,7 @@ class FollowsRequest extends FollowsRequestBuilder {
$qb->limitToType(Follow::TYPE); $qb->limitToType(Follow::TYPE);
$qb->limitToAccepted(true); $qb->limitToAccepted(true);
$cursor = $qb->execute(); $cursor = $qb->executeQuery();
$data = $cursor->fetch(); $data = $cursor->fetch();
$cursor->closeCursor(); $cursor->closeCursor();

Wyświetl plik

@ -80,6 +80,7 @@ class RequestQueueRequest extends RequestQueueRequestBuilder {
/** /**
* Return Queue from database based on the status=0 * Return Queue from database based on the status=0
* *
* @return list<RequestQueue>
* @throws Exception * @throws Exception
*/ */
public function getStandby(): array { public function getStandby(): array {
@ -101,7 +102,7 @@ class RequestQueueRequest extends RequestQueueRequestBuilder {
/** /**
* Return Queue from database based on the token * Return Queue from database based on the token
* *
* @return RequestQueue[] * @return list<RequestQueue>
* @throws Exception * @throws Exception
*/ */
public function getFromToken(string $token, int $status = -1): array { public function getFromToken(string $token, int $status = -1): array {

Wyświetl plik

@ -58,6 +58,7 @@ use OCA\Social\Model\ActivityPub\Actor\Person;
use OCA\Social\Model\ActivityPub\Object\Tombstone; use OCA\Social\Model\ActivityPub\Object\Tombstone;
use OCA\Social\Model\InstancePath; use OCA\Social\Model\InstancePath;
use OCA\Social\Model\RequestQueue; use OCA\Social\Model\RequestQueue;
use Psr\Log\LoggerInterface;
/** /**
* Class ActivityService * Class ActivityService
@ -67,49 +68,26 @@ use OCA\Social\Model\RequestQueue;
class ActivityService { class ActivityService {
use TArrayTools; use TArrayTools;
public const TIMEOUT_LIVE = 3; public const TIMEOUT_LIVE = 3;
public const TIMEOUT_ASYNC = 10; public const TIMEOUT_ASYNC = 10;
public const TIMEOUT_SERVICE = 30; public const TIMEOUT_SERVICE = 30;
private StreamRequest $streamRequest; private StreamRequest $streamRequest;
private FollowsRequest $followsRequest; private FollowsRequest $followsRequest;
private SignatureService $signatureService; private SignatureService $signatureService;
private RequestQueueService $requestQueueService; private RequestQueueService $requestQueueService;
private AccountService $accountService; private AccountService $accountService;
private ConfigService $configService; private ConfigService $configService;
private CurlService $curlService; private CurlService $curlService;
private MiscService $miscService; private MiscService $miscService;
private ?array $failInstances = null; private ?array $failInstances = null;
/**
* ActivityService constructor.
*
* @param StreamRequest $streamRequest
* @param FollowsRequest $followsRequest
* @param SignatureService $signatureService
* @param RequestQueueService $requestQueueService
* @param AccountService $accountService
* @param CurlService $curlService
* @param ConfigService $configService
* @param MiscService $miscService
*/
public function __construct( public function __construct(
StreamRequest $streamRequest, FollowsRequest $followsRequest, StreamRequest $streamRequest, FollowsRequest $followsRequest,
SignatureService $signatureService, RequestQueueService $requestQueueService, SignatureService $signatureService, RequestQueueService $requestQueueService,
AccountService $accountService, CurlService $curlService, ConfigService $configService, AccountService $accountService, CurlService $curlService, ConfigService $configService,
MiscService $miscService MiscService $miscService, LoggerInterface $logger
) { ) {
$this->streamRequest = $streamRequest; $this->streamRequest = $streamRequest;
$this->followsRequest = $followsRequest; $this->followsRequest = $followsRequest;
@ -119,6 +97,7 @@ class ActivityService {
$this->curlService = $curlService; $this->curlService = $curlService;
$this->configService = $configService; $this->configService = $configService;
$this->miscService = $miscService; $this->miscService = $miscService;
$this->logger = $logger;
} }
@ -207,9 +186,6 @@ class ActivityService {
/** /**
* @param ACore $activity
*
* @return string
* @throws SocialAppConfigException * @throws SocialAppConfigException
*/ */
public function request(ACore $activity): string { public function request(ACore $activity): string {
@ -265,6 +241,9 @@ class ActivityService {
try { try {
$this->requestQueueService->initRequest($queue); $this->requestQueueService->initRequest($queue);
} catch (QueueStatusException $e) { } catch (QueueStatusException $e) {
$this->logger->error("Error while trying to init request", [
'exception' => $e,
]);
return; return;
} }