1515from prometheus_client import Counter , Gauge , Histogram
1616from tornado import gen
1717from tornado .httpclient import HTTPClientError
18+ from tornado .ioloop import IOLoop
1819from tornado .iostream import StreamClosedError
1920from tornado .log import app_log
2021from tornado .queues import Queue
@@ -259,7 +260,7 @@ async def get(self, provider_prefix, _unescaped_spec):
259260 return
260261
261262 # create a heartbeat
262- self . settings [ "ioloop" ] .spawn_callback (self .keep_alive )
263+ IOLoop . current () .spawn_callback (self .keep_alive )
263264
264265 spec = spec .rstrip ("/" )
265266 key = f"{ provider_prefix } :{ spec } "
@@ -446,7 +447,7 @@ async def get(self, provider_prefix, _unescaped_spec):
446447 git_credentials = provider .git_credentials ,
447448 sticky_builds = self .settings ["sticky_builds" ],
448449 )
449- build .main_loop = self . settings [ "ioloop" ]
450+ build .main_loop = IOLoop . current ()
450451 else :
451452 build = BuildClass (
452453 # Commented properties should be set in traitlets config
@@ -467,7 +468,7 @@ async def get(self, provider_prefix, _unescaped_spec):
467468 # log_tail_lines=self.settings["log_tail_lines"],
468469 git_credentials = provider .git_credentials ,
469470 # sticky_builds=self.settings["sticky_builds"],
470- main_loop = self . settings [ "ioloop" ] ,
471+ main_loop = IOLoop . current () ,
471472 )
472473 self .build = build
473474
@@ -492,7 +493,7 @@ def _check_result(future):
492493 # Start building
493494 submit_future = pool .submit (build .submit )
494495 submit_future .add_done_callback (_check_result )
495- self . settings [ "ioloop" ] .add_callback (lambda : submit_future )
496+ IOLoop . current () .add_callback (lambda : submit_future )
496497
497498 log_future = None
498499
0 commit comments