make_current is deprecated, remove it

This commit is contained in:
Daniel A. Wozniak 2023-05-27 15:27:19 -07:00 committed by Gareth J. Greenaway
parent 063bf2959e
commit e521194579
6 changed files with 6 additions and 10 deletions

View file

@ -102,8 +102,7 @@ class IRCClient:
self.allow_hosts = allow_hosts
self.allow_nicks = allow_nicks
self.disable_query = disable_query
self.io_loop = tornado.ioloop.IOLoop(make_current=False)
self.io_loop.make_current()
self.io_loop = tornado.ioloop.IOLoop()
self._connect()
def _connect(self):

View file

@ -78,8 +78,7 @@ def start(address=None, port=5000, ssl_crt=None, ssl_key=None):
ssl_options = None
if all([ssl_crt, ssl_key]):
ssl_options = {"certfile": ssl_crt, "keyfile": ssl_key}
io_loop = tornado.ioloop.IOLoop(make_current=False)
io_loop.make_current()
io_loop = tornado.ioloop.IOLoop()
http_server = tornado.httpserver.HTTPServer(application, ssl_options=ssl_options)
http_server.listen(port, address=address)
io_loop.start()

View file

@ -1000,7 +1000,6 @@ class MWorker(salt.utils.process.SignalHandlingProcess):
Bind to the local port
"""
self.io_loop = tornado.ioloop.IOLoop()
self.io_loop.make_current()
for req_channel in self.req_channels:
req_channel.post_fork(
self._handle_payload, io_loop=self.io_loop

View file

@ -968,7 +968,6 @@ class TCPPublishServer(salt.transport.base.DaemonizedPublishServer):
Bind to the interface specified in the configuration file
"""
io_loop = tornado.ioloop.IOLoop()
io_loop.make_current()
# Spin up the publisher
self.pub_server = pub_server = PubServer(

View file

@ -713,7 +713,6 @@ class PublishServer(salt.transport.base.DaemonizedPublishServer):
run in a thread or process as it creates and runs an it's own ioloop.
"""
ioloop = tornado.ioloop.IOLoop()
ioloop.make_current()
self.io_loop = ioloop
context = zmq.Context(1)
pub_sock = context.socket(zmq.PUB)

View file

@ -3,6 +3,7 @@ Helpers/utils for working with tornado asynchronous stuff
"""
import asyncio
import contextlib
import logging
import sys
@ -23,14 +24,14 @@ def current_ioloop(io_loop):
orig_loop = tornado.ioloop.IOLoop.current()
except RuntimeError:
orig_loop = None
io_loop.make_current()
asyncio.set_event_loop(io_loop.asyncio_loop)
try:
yield
finally:
if orig_loop:
orig_loop.make_current()
asyncio.set_event_loop(orig_loop.asyncio_loop)
else:
io_loop.clear_current()
asyncio.set_event_loop(None)
class SyncWrapper: