From bbc9100a1cc5f8b954cfd68da9ee8d9db31366e3 Mon Sep 17 00:00:00 2001 From: ninya9k Date: Sat, 22 May 2021 10:23:09 +0000 Subject: [PATCH] undo extra locking, it was acting weird --- website/viewership.py | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/website/viewership.py b/website/viewership.py index 618d230..38bf0a8 100644 --- a/website/viewership.py +++ b/website/viewership.py @@ -29,23 +29,23 @@ def setdefault(token): return with lock: remove_absent_viewers() - viewers[token] = {'token': token, - 'last_comment': float('-inf'), - 'last_segment': float('-inf'), - 'last_request': float('-inf'), - 'first_request': float('-inf'), - 'verified': False, - 'recent_comments': [], - 'nickname': None, - 'colour': colour.gen_colour(token.encode(), *(viewers[token]['colour'] for token in viewers)), - 'banned': False, - 'tripcode': tripcode.default(), - 'broadcaster': False} - viewers[token]['tag'] = colour.tag(token) - if token == BROADCASTER_TOKEN: - viewers[token]['broadcaster'] = True - viewers[token]['colour'] = BROADCASTER_COLOUR - viewers[token]['verified'] = True + viewers[token] = {'token': token, + 'last_comment': float('-inf'), + 'last_segment': float('-inf'), + 'last_request': float('-inf'), + 'first_request': float('-inf'), + 'verified': False, + 'recent_comments': [], + 'nickname': None, + 'colour': colour.gen_colour(token.encode(), *(viewers[token]['colour'] for token in viewers)), + 'banned': False, + 'tripcode': tripcode.default(), + 'broadcaster': False} + viewers[token]['tag'] = colour.tag(token) + if token == BROADCASTER_TOKEN: + viewers[token]['broadcaster'] = True + viewers[token]['colour'] = BROADCASTER_COLOUR + viewers[token]['verified'] = True # TODO: generalise this and reduce the number of keys in last_request; comment is used for flood detection and the rest is for get_user_list def made_request(token):