Can't immediately receive multiple notifications in Npgsql

前端 未结 2 1857
离开以前
离开以前 2021-01-03 10:36

Today i wrote the following code that works with PostgreSQL C# library named Npgsql:

using System;
using System.Collections.Generic;
using System.Linq;
using         


        
相关标签:
2条回答
  • 2021-01-03 11:15

    Unless your client library supports checking the network socket for buffered data, the only way to receive notifications is to trigger some other activity on the socket.

    Many applications periodically send an empty query string ("") to do this.

    If the client library supports it and you are not using SSL, it might be possible to periodically call some kind of checkForNotifications() function on the connection. This is possible in PgJDBC, but I don't know nPgSQL, so I can only advise you to check out the documentation for that.

    0 讨论(0)
  • 2021-01-03 11:31

    UPDATE (2015-02-27): This bug is already fixed in our master branch on github. Note that master branch is our upcoming 3.0 version and may have some bugs we are working on. Please, give it a try and let me know if it works for you.

    This is a bug in Npgsql. We are working to fix it. Check this pull request for more info about it: https://github.com/franciscojunior/Npgsql2/pull/46 in special the commit: https://github.com/glenebob/Npgsql2/commit/98fd469048a20119755777ce3a8ffc4397f4a114

    But we are trying another approaches in order to fix this problem. Note that this problem only occurs when you send multiple notifications in a very short period. If you keep a space of 1 or 2 seconds between notifications, they are delivered correctly.

    As soon as we get it fixed I'll update my answer here.

    Sorry for all the inconvenience this problem may have caused.

    0 讨论(0)
提交回复
热议问题