-
Notifications
You must be signed in to change notification settings - Fork 72
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 timestamp support in send and send_batch #320
Conversation
@ChuckHend So is there anything else left to work on or can this be merged now? |
Test cases would be great! |
I figured it wouldn't be necessary since send with normal seconds delay isn't tested. |
You are correct, we don't have a test to ensure that the |
@ChuckHend I have added tests, tell me your thoughts. |
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.
I think it would probably be a better API if instead send
and send_batch
were overloaded to support both a delay and a timestamp.
@v0idpwn I've already talked with ChuckHend about this And an issue remains and that is, which function to run when you only put 2 arguments |
Sorry, missed it because it was resolved :) |
if both variable are not none, you can simple raise an exception to user that those variable can not be use together. |
another question if user add delay can change it to vt or vise versa? what will happened? what we except? |
No, the issue is that Postgres will raise an exception if there are two overloading functions with the only difference being a default parameter. |
What do you mean? |
Is there anything else I'm missing or is this PR done now? |
Sorry, but I can't understand why we can't use delay as an option beside vt with default none or zero? |
Look, if we overload two functions like this pgmq.send_batch(
queue_name text,
msgs jsonb[],
delay timestamp DEFAULT CURRENT_TIMESTAMP
);
pgmq.send_batch(
queue_name text,
msgs jsonb[],
delay integer DEFAULT 0
); Postgres will raise an exception because it won't know which one to run if you just put the first two parameters. |
@ChuckHend Fixed tests, tell me if there's anything missing now. |
@ChuckHend @tavallaie not sure what should be done with the python client after these changes :) |
@Neptune650 I pushed the following changes:
I think the extension code is fine now. We just need to figure what to do in the python api. |
@v0idpwn All sounds good to me, I was thinking we could leave the Python function names as is, while internally calling the overloaded pgmq.send |
I think we can add parameters of delay and ts with a default value of none; check if those, too are not none and use overloaded functions instead. |
@tavallaie I have pushed the changes you suggested, please tell me what you think |
@Neptune650 did you update unit tests too? |
@tavallaie There's no need, they're working fine without changes. |
They are working because not supporting new scenarios like delay For adding new scenarios we need new tests. |
@Neptune650 , @tavallaie thoughts on moving the python changes to a new PR and focus on getting the SQL API changes approved? Also, while the python client changes are very helpful IMO they are out of scope to the bounty that @Neptune650 is working on. |
Ok. |
@ChuckHend Sounds good to me, I can create another PR for the Python changes (I'd appreciate if it was with a separate tip but I'll send it either way) |
@Neptune650 would you please revert the Python changes, then? Then I can merge. |
@v0idpwn I reverted the changes, please merge. |
If you are busy, I can do that. |
@tavallaie I've created a PR for it #333 |
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.
Thank you @Neptune650
@ChuckHend No problem - please merge if ready. |
/claim #315
Closes #315
This pull request creates two functions - send_at and send_batch_at - which receive a timestamp and convert it to seconds from now.
This also documents both functions.