-
Notifications
You must be signed in to change notification settings - Fork 2
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
Update for tornado 6 #6
Update for tornado 6 #6
Conversation
Since the use of io_loop as a function parameter in tornado is removed, IOLoop.current() is the way to get the instance and run functions on it
Task was also deprecated and removed in tornado 6, but it's also not useful anymore since the function "fetch" that was being called also no longer supports the "callback" argument that Task was supplying. It instead recommends to use the returned Future instance instead, which is the same as what Task used to do.
# Use the default IO loop | ||
self.io_loop = IOLoop.current() |
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.
Is this used anywhere since it's not going into LongPollingTransport
?
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.
self.io_loop
is used later in the Client class on lines 161 and 210.
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 wonder if that can be refactored too, but no need to figure that out now.
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.
Looks good. I'm pretty sure the failures are on master
due to old python versions and old config. I'll get this merged, fix that up, and then tag a release.
Tornado 6 removed the
io_loop
parameter, which removed the ability to create and pass in your own instance of it. This PR makes baiocas compatible with tornado 6 by removing the ability to create or pass in IOLoops to tornado. For code that runs functions on IOLoops created the old way,IOLoop.current()
is used to get the current instance instead.Tornado 6 also removed the
Task
function (deprecated in v5), which adapted callback-based functions to be used in coroutines.Task
was used to callAsyncHTTPClient.fetch
and get aFuture
instance. However,fetch
in v6 removed thecallback
argument and returns aFuture
instance directly (documentation), so this PR changes baiocas to just call the function directly and use its return value.Test cases pass.