Minor cleanup of todos and imports
This commit is contained in:
		@@ -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
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user