Skip to content
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

parse Postgres notifications; add method wait() to wait for them #28

Merged
merged 3 commits into from Jun 15, 2016

Conversation

starius
Copy link
Contributor

@starius starius commented Apr 6, 2016

No description provided.

Currently only notifications are supported.
Notices and parameter statuses are not implemented.

See also:

NOTIFY command
    http://www.postgresql.org/docs/9.0/static/sql-notify.html
Asynchronous Operations:
    http://www.postgresql.org/docs/9.1/static/protocol-flow.html
Protocol:
    http://www.postgresql.org/docs/9.1/static/protocol-message-formats.html
It is needed to send 'listen channel' and 'unlisten channel'
commands on a socket being read by another light thread in the
same Lua handler.

With reference to lua-nginx-module's documentation:

> Starting from the 0.9.9 release, the cosocket object here is full-duplex,
> that is, a reader "light thread" and a writer "light thread" can operate
> on a single cosocket object simultaneously (both "light threads" must
> belong to the same Lua handler though, see reasons above). But you cannot
> have two "light threads" both reading (or writing or connecting) the same
> cosocket, otherwise you might get an error like "socket busy reading" when
> calling the methods of the cosocket object.
@leafo
Copy link
Owner

leafo commented Jun 15, 2016

I'm worried about making the query interface confusing with more return values. If we want to return more information about a query (like notices), where would they go? What about putting the notifications, if we receive them, into the results object with a key notifications?

@leafo
Copy link
Owner

leafo commented Jun 15, 2016

also I updated wait to wait_for_notification, the lapis PR will need to be updated

@starius starius deleted the notifications branch June 15, 2016 08:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants