You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the issue
Notifications are not all delivered at once when calling getNotifications() unless you execute a query beforehand.
I believe it is related to the change in commit: e2623d6 in PGStream in hasMessagePending()
It will add the first notification to the list to be returned, then since the nextStreamAvailableCheckTime gets set to 1s in the future in the prior call, the next call immediately after to get any remaining notifications returns false, even though there are notifications pending.
Driver Version?
42.2.6 Java Version?
8 OS Version?
Windows / Linux PostgreSQL Version?
10 To Reproduce
If I were to open a connection listening on a channel, then in another process execute NOTIFY 30 times in quick succession for that channel, only one notification will be returned per call to getNotifications() per second.
For example, with a loop calling getNotifications() every 100ms, it would return a single notification every 10 calls, and would take 30 seconds of wall-clock time, and 300 calls of getNotifications() to process the 30 notifications which were queued up.
Running a simple query (SELECT 1;) beforehand will allow all notifications to be received and processed by a single call to getNotifications().
Expected behaviour
All prior notifications to the channel should be returned if a user calls getNotifications().
The text was updated successfully, but these errors were encountered:
Describe the issue
Notifications are not all delivered at once when calling getNotifications() unless you execute a query beforehand.
I believe it is related to the change in commit: e2623d6 in PGStream in hasMessagePending()
It will add the first notification to the list to be returned, then since the nextStreamAvailableCheckTime gets set to 1s in the future in the prior call, the next call immediately after to get any remaining notifications returns false, even though there are notifications pending.
Driver Version?
42.2.6
Java Version?
8
OS Version?
Windows / Linux
PostgreSQL Version?
10
To Reproduce
If I were to open a connection listening on a channel, then in another process execute NOTIFY 30 times in quick succession for that channel, only one notification will be returned per call to getNotifications() per second.
For example, with a loop calling getNotifications() every 100ms, it would return a single notification every 10 calls, and would take 30 seconds of wall-clock time, and 300 calls of getNotifications() to process the 30 notifications which were queued up.
Running a simple query (SELECT 1;) beforehand will allow all notifications to be received and processed by a single call to getNotifications().
Expected behaviour
All prior notifications to the channel should be returned if a user calls getNotifications().
The text was updated successfully, but these errors were encountered: