Minor cleanup of todos and imports
This commit is contained in:
parent
8be2e81054
commit
69fd46b73a
@ -89,8 +89,6 @@ class ApiHandler
|
||||
*/
|
||||
private function apiGetSubscriptions(string|null $topic, string|null $subscription): ResponseInterface
|
||||
{
|
||||
// TODO implement once we can enumerate topics and subscriptions
|
||||
|
||||
$subscriptions = $this->topicManager->getSubscriptions();
|
||||
$lastEventId = $this->topicManager->getLastEventId();
|
||||
$data = [
|
||||
|
@ -2,14 +2,12 @@
|
||||
|
||||
namespace NoccyLabs\Mercureact\Http\Middleware;
|
||||
|
||||
use LDAP\Result;
|
||||
use NoccyLabs\Mercureact\Broker\Message;
|
||||
use NoccyLabs\Mercureact\Broker\SseSubscriber;
|
||||
use NoccyLabs\Mercureact\Broker\TopicManager;
|
||||
use NoccyLabs\Mercureact\Configuration;
|
||||
use NoccyLabs\Mercureact\Http\Exception\RequestException;
|
||||
use NoccyLabs\Mercureact\Http\Exception\SecurityException;
|
||||
use NoccyLabs\SimpleJWT\JWTToken;
|
||||
use Psr\Http\Message\ResponseInterface;
|
||||
use Psr\Http\Message\ServerRequestInterface;
|
||||
use React\EventLoop\Loop;
|
||||
@ -172,12 +170,14 @@ class MercureHandler
|
||||
);
|
||||
}
|
||||
|
||||
// Explicitly check for duplicate message IDs.
|
||||
if ($this->config->getRejectDuplicateMessages() && !empty($data['id'])) {
|
||||
if (in_array($data['id'], $this->seenMessageIds)) {
|
||||
return Response::plaintext("Duplicate message id")->withStatus(Response::STATUS_BAD_REQUEST);
|
||||
}
|
||||
array_push($this->seenMessageIds, $data['id']);
|
||||
$this->seenMessageIds = array_slice($this->seenMessageIds, -100, 100);
|
||||
while (count($this->seenMessageIds) > $this->seenIdHistorySize)
|
||||
array_shift($this->seenMessageIds);
|
||||
}
|
||||
|
||||
// Put an id in there if none already
|
||||
|
Loading…
Reference in New Issue
Block a user