10000 [DoctrineMessenger] [WIP] Postgres LISTEN/NOTIFY improvement proposition for better handling of time limit, multi-queue worker and delayed tasks by d-ph · Pull Request #47666 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

[DoctrineMessenger] [WIP] Postgres LISTEN/NOTIFY improvement proposition for better handling of time limit, multi-queue worker and delayed tasks #47666

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: 7.4
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
#45882 [Messenger] Be able to start a worker for multiple queues with…
… custom consumption priorities. Replay #47209 on top of this code change.
  • Loading branch information
d-ph committed Dec 9, 2022
commit 536ac22aba5457ec12cd392e15919c17a1d8130d
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,6 @@ final class PostgreSqlConnection extends Connection
'get_notify_timeout' => 0,
];

private bool $listening = false;

public function __sleep(): array
{
throw new \BadMethodCallException('Cannot serialize '.__CLASS__);
Expand Down Expand Up @@ -116,21 +114,16 @@ private function createTriggerFunctionName(): string
*/
public function registerPgNotifyListener(): void
{
if ($this->listening) {
return;
}

// This is secure because the table name must be a valid identifier:
// https://www.postgresql.org/docs/current/sql-syntax-lexical.html#SQL-SYNTAX-IDENTIFIERS
// Running "LISTEN" potentially multiple times is expected and desired, as discussed here:
// https://github.com/symfony/symfony/pull/47209
$this->executeStatement(sprintf('LISTEN "%s"', $this->configuration['table_name']));

$this->listening = true;
}

private function unlisten()
{
$this->executeStatement(sprintf('UNLISTEN "%s"', $this->configuration['table_name']));
$this->listening = false;
}

/**
Expand Down
0