-
Notifications
You must be signed in to change notification settings - Fork 51
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 asynchronous execution #109
Conversation
(deleted the duplicate submissions) |
Co-Authored-By: Lyndon White <oxinabox@ucc.asn.au>
end | ||
end | ||
|
||
iserror(async_result::AsyncResult) = Base.istaskfailed(async_result.result_task) |
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.
Do we need to open an upstream issue to get this exported?
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.
Yes
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.
Co-Authored-By: Lyndon White <oxinabox@ucc.asn.au>
Co-Authored-By: Lyndon White <oxinabox@ucc.asn.au>
Base.islocked(conn::Connection) = islocked(conn.lock) | ||
Base.lock(conn::Connection) = acquire(conn.semaphore) | ||
Base.unlock(conn::Connection) = release(conn.semaphore) | ||
Base.islocked(conn::Connection) = conn.semaphore.curr_cnt >= conn.semaphore.sem_size |
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.
We should raise an issue up stream that semaphore does not implement islocked
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.
finally | ||
unlock(conn) | ||
end | ||
end |
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.
why did yo unroll this rather than using lock(f, conn.lock)
?
Is it because Semaphore's don't implement that pattern?
if so we should open an issue about it
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.
Yes
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.
Also, lock(f, the_lock)
is restricted to ::AbstractLock
, even though It probably shouldn't be. I mentioned that one a draft PR I made that no one looked at.
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.
Do |
|
Ok, I am now in-principle happy with this PR. |
Adds support for asynchronous execution using https://www.postgresql.org/docs/10/libpq-async.html
TODO:
task.sticky = false
@par
, will wait another release to be sure it's not a bad interaction with the uv event loop