feat: add low priority RDAP message queue

This commit is contained in:
Maël Gangloff 2025-10-31 16:40:42 +01:00
parent 0fa95cc95c
commit ff5a2d7d67
No known key found for this signature in database
GPG Key ID: 11FDC81C24A7F629
4 changed files with 12 additions and 6 deletions

3
.env
View File

@ -56,7 +56,8 @@ MESSENGER_CONSUMER_NAME=worker
# MESSENGER_TRANSPORT_DSN=amqp://guest:guest@localhost:5672/%2f/messages # MESSENGER_TRANSPORT_DSN=amqp://guest:guest@localhost:5672/%2f/messages
# MESSENGER_TRANSPORT_DSN=redis://localhost:6379/messages # MESSENGER_TRANSPORT_DSN=redis://localhost:6379/messages
MESSENGER_ASYNC_TRANSPORT_DSN=redis://localhost:6379/messages?lazy=1 MESSENGER_ASYNC_TRANSPORT_DSN=redis://localhost:6379/messages?lazy=1
MESSENGER_RDAP_ASYNC_TRANSPORT_DSN=redis://localhost:6379/messages-rdap?lazy=1 MESSENGER_RDAP_LOW_TRANSPORT_DSN=redis://localhost:6379/messages-rdap-low?lazy=1
MESSENGER_RDAP_HIGH_TRANSPORT_DSN=redis://localhost:6379/messages-rdap-high?lazy=1
###< symfony/messenger ### ###< symfony/messenger ###

View File

@ -10,7 +10,7 @@ framework:
max_retries: 3 max_retries: 3
multiplier: 2 multiplier: 2
rdap_high: rdap_high:
dsn: '%env(MESSENGER_RDAP_ASYNC_TRANSPORT_DSN)%' dsn: '%env(MESSENGER_RDAP_HIGH_TRANSPORT_DSN)%'
options: options:
consumer: '%env(MESSENGER_CONSUMER_NAME)%' consumer: '%env(MESSENGER_CONSUMER_NAME)%'
retry_strategy: retry_strategy:
@ -19,7 +19,7 @@ framework:
max_delay: 86400000 max_delay: 86400000
rdap_low: rdap_low:
dsn: '%env(MESSENGER_RDAP_ASYNC_TRANSPORT_DSN)%' dsn: '%env(MESSENGER_RDAP_LOW_TRANSPORT_DSN)%'
options: options:
consumer: '%env(MESSENGER_CONSUMER_NAME)%' consumer: '%env(MESSENGER_CONSUMER_NAME)%'
retry_strategy: retry_strategy:

View File

@ -12,7 +12,8 @@ services:
SERVER_NAME: ${SERVER_NAME:-:80} SERVER_NAME: ${SERVER_NAME:-:80}
DATABASE_URL: postgresql://${POSTGRES_USER:-app}:${POSTGRES_PASSWORD:-!ChangeMe!}@database:${POSTGRES_PORT:-5432}/${POSTGRES_DB:-app}?serverVersion=${POSTGRES_VERSION:-15}&charset=${POSTGRES_CHARSET:-utf8} DATABASE_URL: postgresql://${POSTGRES_USER:-app}:${POSTGRES_PASSWORD:-!ChangeMe!}@database:${POSTGRES_PORT:-5432}/${POSTGRES_DB:-app}?serverVersion=${POSTGRES_VERSION:-15}&charset=${POSTGRES_CHARSET:-utf8}
MESSENGER_ASYNC_TRANSPORT_DSN: redis://valkey:6379/messages MESSENGER_ASYNC_TRANSPORT_DSN: redis://valkey:6379/messages
MESSENGER_RDAP_ASYNC_TRANSPORT_DSN: redis://valkey:6379/messages-rdap MESSENGER_RDAP_LOW_TRANSPORT_DSN: redis://valkey:6379/messages-rdap-low
MESSENGER_RDAP_HIGH_TRANSPORT_DSN: redis://valkey:6379/messages-rdap-high
volumes: volumes:
- caddy_data:/data - caddy_data:/data
- caddy_config:/config - caddy_config:/config
@ -33,7 +34,8 @@ services:
APP_ENV: prod APP_ENV: prod
DATABASE_URL: postgresql://${POSTGRES_USER:-app}:${POSTGRES_PASSWORD:-!ChangeMe!}@database:${POSTGRES_PORT:-5432}/${POSTGRES_DB:-app}?serverVersion=${POSTGRES_VERSION:-15}&charset=${POSTGRES_CHARSET:-utf8} DATABASE_URL: postgresql://${POSTGRES_USER:-app}:${POSTGRES_PASSWORD:-!ChangeMe!}@database:${POSTGRES_PORT:-5432}/${POSTGRES_DB:-app}?serverVersion=${POSTGRES_VERSION:-15}&charset=${POSTGRES_CHARSET:-utf8}
MESSENGER_ASYNC_TRANSPORT_DSN: redis://valkey:6379/messages MESSENGER_ASYNC_TRANSPORT_DSN: redis://valkey:6379/messages
MESSENGER_RDAP_ASYNC_TRANSPORT_DSN: redis://valkey:6379/messages-rdap MESSENGER_RDAP_LOW_TRANSPORT_DSN: redis://valkey:6379/messages-rdap-low
MESSENGER_RDAP_HIGH_TRANSPORT_DSN: redis://valkey:6379/messages-rdap-high
MESSENGER_CONSUMER_NAME: worker MESSENGER_CONSUMER_NAME: worker
depends_on: depends_on:
- database - database

View File

@ -24,6 +24,7 @@ use Symfony\Component\Mailer\MailerInterface;
use Symfony\Component\Messenger\Attribute\AsMessageHandler; use Symfony\Component\Messenger\Attribute\AsMessageHandler;
use Symfony\Component\Messenger\Exception\ExceptionInterface; use Symfony\Component\Messenger\Exception\ExceptionInterface;
use Symfony\Component\Messenger\MessageBusInterface; use Symfony\Component\Messenger\MessageBusInterface;
use Symfony\Component\Messenger\Stamp\TransportNamesStamp;
use Symfony\Component\Mime\Address; use Symfony\Component\Mime\Address;
use Symfony\Component\Notifier\Recipient\Recipient; use Symfony\Component\Notifier\Recipient\Recipient;
use Symfony\Contracts\HttpClient\Exception\ClientExceptionInterface; use Symfony\Contracts\HttpClient\Exception\ClientExceptionInterface;
@ -89,7 +90,9 @@ final readonly class UpdateDomainHandler
if (null === $watchlist) { if (null === $watchlist) {
/** @var Watchlist $wl */ /** @var Watchlist $wl */
foreach ($domain->getWatchlists()->getIterator() as $wl) { foreach ($domain->getWatchlists()->getIterator() as $wl) {
$this->bus->dispatch(new UpdateDomain($message->ldhName, $wl->getToken())); $this->bus->dispatch(new UpdateDomain($message->ldhName, $wl->getToken()), [
new TransportNamesStamp('rdap_low'),
]);
} }
return; return;