-
Notifications
You must be signed in to change notification settings - Fork 61
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
Add pgmq_read_with_poll #64
Conversation
I think we should make it configurable with a default. Postgres does let us have optional parameters in functions: Line 12 in df7b396
Seconds seems good to me, to be consistent with rest of pgmq. SQS is seconds too, right? |
@@ -234,14 +235,14 @@ pub fn read(name: &str, vt: i32, limit: i32) -> Result<String, PgmqError> { | |||
( | |||
SELECT msg_id | |||
FROM {PGMQ_SCHEMA}.{TABLE_PREFIX}_{name} | |||
WHERE vt <= now() | |||
WHERE vt <= clock_timestamp() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
now()
uses transaction start time. This can be pretty useful, but in this case, if we repeatedly query it will always use the same timestamp. I also tried statement_timestamp()
, but for some reason while using the SPI I got the same timestamp for different runs 🤔, so I resorted to clock_timestamp()
For feature parity with SQS. The implementation is a bit naive: it simply will retry querying for messages on a small interval until the timeout is reached.
ca79a3e
to
7a8f246
Compare
fd24f80
to
3738c57
Compare
3738c57
to
275da04
Compare
1b4ae3e
to
bfa5754
Compare
730d554
to
591907c
Compare
591907c
to
14f095b
Compare
@v0idpwn , the Rust client library tests are run against the container image with pgmq installed in it - and the image is currently only built when the extension is released. So the Rust client library tests will fail since they are looking for the new long poll function, which wont be released yet. |
For feature parity with SQS. The implementation is a bit naive: it simply will retry querying for messages on a small interval until the timeout is reached.
To be discussed:
To be done: