Skip to content

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

Merged
leafo merged 3 commits into
leafo:masterfrom
starius:notifications
Jun 15, 2016
Merged

leafo merged 3 commits into
leafo:masterfrom
starius:notifications

Conversation

@starius

@starius starius commented Apr 6, 2016

Copy link
Copy Markdown
Contributor

No description provided.

starius added 3 commits April 3, 2016 04:50
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

leafo commented Jun 15, 2016 •

Copy link
Copy Markdown
Owner

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

leafo commented Jun 15, 2016

Copy link
Copy Markdown
Owner

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.

2 participants