Skip to content

Commit

Permalink
bug #36990 [Messenger] Change the default notify timeout value for Po…
Browse files Browse the repository at this point in the history
…stgreSQL (fabpot)

This PR was merged into the 5.1 branch.

Discussion
----------

[Messenger] Change the default notify timeout value for PostgreSQL

| Q             | A
| ------------- | ---
| Branch?       | 5.1 <!-- see below -->
| Bug fix?      | yes-ish
| New feature?  | no <!-- please update src/**/CHANGELOG.md files -->
| Deprecations? | no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files -->
| Tickets       | n/a <!-- prefix each issue number with "Fix #", if any -->
| License       | MIT
| Doc PR        | n/a

The default value of 0 means that notify is kind of disable and that incurs many SQL requests. 10 minutes is kind of arbitrary but seems to be a good balance between waiting for a message (blocking) and trying again later in case of an issue.

Commits
-------

d9decf9 [Messenger] Change the default notify timeout value for PostgreSQL
  • Loading branch information
fabpot committed May 29, 2020
2 parents 50dda4c + d9decf9 commit 2ff26b7
Showing 1 changed file with 4 additions and 2 deletions.
Expand Up @@ -24,11 +24,11 @@ final class PostgreSqlConnection extends Connection
{
/**
* * use_notify: Set to false to disable the use of LISTEN/NOTIFY. Default: true
* * check_delayed_interval: The interval to check for delayed messages, in milliseconds. Set to 0 to disable checks. Default: 1000
* * check_delayed_interval: The interval to check for delayed messages, in milliseconds. Set to 0 to disable checks. Default: 60000 (1 minute)
* * get_notify_timeout: The length of time to wait for a response when calling PDO::pgsqlGetNotify, in milliseconds. Default: 0.
*/
protected const DEFAULT_OPTIONS = parent::DEFAULT_OPTIONS + [
'check_delayed_interval' => 1000,
'check_delayed_interval' => 60000,
'get_notify_timeout' => 0,
];

Expand Down Expand Up @@ -75,6 +75,8 @@ public function get(): ?array
// delayed messages
(microtime(true) * 1000 - $this->queueEmptiedAt < $this->configuration['check_delayed_interval'])
) {
usleep(1000);

return null;
}

Expand Down

0 comments on commit 2ff26b7

Please sign in to comment.