Skip to content

Commit 93aa2d5

Browse files
committed
fix: mark more potential blocking functions in webtiles
1 parent acc37e2 commit 93aa2d5

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

crawl-ref/source/webserver/webtiles/ws_handler.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -336,6 +336,7 @@ def select_subprotocol(self, subprotocols):
336336
return "no-compression"
337337
return None
338338

339+
@util.note_blocking_fun
339340
def open(self):
340341
compression = "on"
341342
if isinstance(self.ws_connection, getattr(tornado.websocket, "WebSocketProtocol76", ())):
@@ -392,6 +393,7 @@ def send_lobby_data(self):
392393
self.queue_message("lobby_entry", **process.lobby_entry())
393394
self.send_message("lobby_complete")
394395

396+
@util.note_blocking_fun
395397
def send_lobby(self):
396398
self.send_lobby_data()
397399
self.send_lobby_html()
@@ -429,12 +431,15 @@ def invalidate_saveslot_cache(self, slot):
429431
# collect save info for the player from all binaries that support save
430432
# info json. Cached on self.save_info. This is asynchronously done using
431433
# a somewhat involved callback chain.
434+
@util.note_blocking_fun
432435
def collect_save_info(self, final_callback):
433436
if not self.username:
434437
return
435438

436439
# this code would be much simpler refactored using async
440+
@util.note_blocking_fun
437441
def build_callback(game_key, call, next_callback):
442+
@util.note_blocking_fun
438443
def update_save_info(data, returncode):
439444
global sockets
440445
if not self in sockets:
@@ -488,6 +493,7 @@ def update_save_info(data, returncode):
488493

489494
callback()
490495

496+
@util.note_blocking_fun
491497
def send_lobby_html(self):
492498
# Rerender Banner
493499
# TODO: don't really need to do this every time the lobby is loaded?
@@ -499,6 +505,7 @@ def send_lobby_html(self):
499505
return
500506
def disable_check(s):
501507
return s == "[slot full]"
508+
@util.note_blocking_fun
502509
def send_game_links():
503510
global sockets
504511
if not self in sockets:
@@ -584,6 +591,7 @@ def game_id_allowed(self, game_id):
584591
# start.
585592
return "allowed_with_hold" not in game or game["allowed_with_hold"]
586593

594+
@util.note_blocking_fun
587595
def start_crawl(self, game_id):
588596
if config.get('dgl_mode') and game_id not in config.games:
589597
self.go_lobby()
@@ -651,6 +659,7 @@ def start_crawl(self, game_id):
651659
update_all_lobbys(self.process)
652660
update_global_status()
653661

662+
@util.note_blocking_fun
654663
def _on_crawl_end(self):
655664
if config.get('dgl_mode'):
656665
remove_in_lobbys(self.process)
@@ -686,6 +695,7 @@ def _on_crawl_end(self):
686695
# The last crawl process has ended, now we can go
687696
IOLoop.current().stop()
688697

698+
@util.note_blocking_fun
689699
def init_user(self, callback):
690700
# this would be more cleanly implemented with wait_for_exit, but I
691701
# can't get code for that to work in a way that supports all currently
@@ -724,6 +734,7 @@ def shutdown(self):
724734
if self.is_running():
725735
self.process.stop()
726736

737+
@util.note_blocking_fun
727738
def do_login(self, username):
728739
self.username = username
729740
self.user_flags = None
@@ -736,6 +747,7 @@ def do_login(self, username):
736747
self.send_message("login_fail", reason=fail_reason)
737748
return
738749

750+
@util.note_blocking_fun
739751
def login_callback(result):
740752
success = result == 0
741753
if not success:

0 commit comments

Comments
 (0)