mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
make_current is deprecated, remove it
This commit is contained in:
parent
063bf2959e
commit
e521194579
6 changed files with 6 additions and 10 deletions
|
@ -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):
|
||||
|
|
|
@ -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()
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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(
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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:
|
||||
|
|
Loading…
Add table
Reference in a new issue