summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCarl Schwan <carl@carlschwan.eu>2022-10-28 10:39:18 +0200
committerCarl Schwan <carl@carlschwan.eu>2022-10-28 10:39:18 +0200
commit1e4a9f2cab8de2a581f536a6985097525e272747 (patch)
treea26977be5bf7619b23d394bcdd04c49c0a2130b0
parent60f7ce31bb9db1f8a26305daf3e372f3cefda308 (diff)
Fix more bugs
Signed-off-by: Carl Schwan <carl@carlschwan.eu>
-rw-r--r--lib/Db/FollowsRequest.php2
-rw-r--r--lib/Db/RequestQueueRequest.php3
-rw-r--r--lib/Service/ActivityService.php33
3 files changed, 9 insertions, 29 deletions
diff --git a/lib/Db/FollowsRequest.php b/lib/Db/FollowsRequest.php
index 4a7ea538..c74b6038 100644
--- a/lib/Db/FollowsRequest.php
+++ b/lib/Db/FollowsRequest.php
@@ -154,7 +154,7 @@ class FollowsRequest extends FollowsRequestBuilder {
$qb->limitToType(Follow::TYPE);
$qb->limitToAccepted(true);
- $cursor = $qb->execute();
+ $cursor = $qb->executeQuery();
$data = $cursor->fetch();
$cursor->closeCursor();
diff --git a/lib/Db/RequestQueueRequest.php b/lib/Db/RequestQueueRequest.php
index 51f21d40..d043038d 100644
--- a/lib/Db/RequestQueueRequest.php
+++ b/lib/Db/RequestQueueRequest.php
@@ -80,6 +80,7 @@ class RequestQueueRequest extends RequestQueueRequestBuilder {
/**
* Return Queue from database based on the status=0
*
+ * @return list<RequestQueue>
* @throws Exception
*/
public function getStandby(): array {
@@ -101,7 +102,7 @@ class RequestQueueRequest extends RequestQueueRequestBuilder {
/**
* Return Queue from database based on the token
*
- * @return RequestQueue[]
+ * @return list<RequestQueue>
* @throws Exception
*/
public function getFromToken(string $token, int $status = -1): array {
diff --git a/lib/Service/ActivityService.php b/lib/Service/ActivityService.php
index dd514a9d..f5fa1627 100644
--- a/lib/Service/ActivityService.php
+++ b/lib/Service/ActivityService.php
@@ -58,6 +58,7 @@ use OCA\Social\Model\ActivityPub\Actor\Person;
use OCA\Social\Model\ActivityPub\Object\Tombstone;
use OCA\Social\Model\InstancePath;
use OCA\Social\Model\RequestQueue;
+use Psr\Log\LoggerInterface;
/**
* Class ActivityService
@@ -67,49 +68,26 @@ use OCA\Social\Model\RequestQueue;
class ActivityService {
use TArrayTools;
-
public const TIMEOUT_LIVE = 3;
public const TIMEOUT_ASYNC = 10;
public const TIMEOUT_SERVICE = 30;
-
private StreamRequest $streamRequest;
-
private FollowsRequest $followsRequest;
-
private SignatureService $signatureService;
-
private RequestQueueService $requestQueueService;
-
private AccountService $accountService;
-
private ConfigService $configService;
-
private CurlService $curlService;
-
private MiscService $miscService;
-
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(
StreamRequest $streamRequest, FollowsRequest $followsRequest,
SignatureService $signatureService, RequestQueueService $requestQueueService,
AccountService $accountService, CurlService $curlService, ConfigService $configService,
- MiscService $miscService
+ MiscService $miscService, LoggerInterface $logger
) {
$this->streamRequest = $streamRequest;
$this->followsRequest = $followsRequest;
@@ -119,6 +97,7 @@ class ActivityService {
$this->curlService = $curlService;
$this->configService = $configService;
$this->miscService = $miscService;
+ $this->logger = $logger;
}
@@ -207,9 +186,6 @@ class ActivityService {
/**
- * @param ACore $activity
- *
- * @return string
* @throws SocialAppConfigException
*/
public function request(ACore $activity): string {
@@ -265,6 +241,9 @@ class ActivityService {
try {
$this->requestQueueService->initRequest($queue);
} catch (QueueStatusException $e) {
+ $this->logger->error("Error while trying to init request", [
+ 'exception' => $e,
+ ]);
return;
}