Skip to content
Permalink
Browse files

Be sure to set report_data after acquiring lock

  • Loading branch information...
quartata committed Dec 7, 2017
1 parent 3907b6c commit d89fc9b885c3cd484e623f591cf453fb015af177
Showing with 12 additions and 13 deletions.
  1. +8 −11 chatcommunicate.py
  2. +2 −2 deletionwatcher.py
  3. +2 −0 rooms.yml
@@ -136,10 +136,11 @@ def pickle_last_messages():

def send_messages():
while True:
room, msg = _msg_queue.get()
room, msg, report_data = _msg_queue.get()

room.lock.wait()
room.lock.clear()
room.last_report_data = report_data

full_retries = 0

@@ -251,16 +252,12 @@ def tell_rooms(msg, has, hasnt, notify_site="", report_data=()):
if room.block_time < timestamp and _global_block < timestamp:
msg = msg.rstrip()

if report_data:
room.last_report_data = report_data

if "delay" in _room_roles and room_id in _room_roles["delay"]:
threading.Thread(name="delayed post",
target=DeletionWatcher.post_message_if_not_deleted,
args=(report_data[0], msg, room)).start()
continue

_msg_queue.put((room, msg))
if report_data and "delay" in _room_roles and room_id in _room_roles["delay"]:
threading.Thread(name="delayed post",
target=DeletionWatcher.post_message_if_not_deleted,
args=(report_data[0], msg, room, report_data)).start()
else:
_msg_queue.put((room, msg, report_data))


def get_last_messages(room, count):
@@ -92,11 +92,11 @@ def check_if_report_was_deleted(self, post_url, message):
pass

@classmethod
def post_message_if_not_deleted(self, post_url, message_text, room):
def post_message_if_not_deleted(self, post_url, message_text, room, report_data):
post_site_id = fetch_post_id_and_site_from_url(post_url)
was_report_deleted = self.check_websocket_for_deletion(post_site_id, post_url, 300)

if not was_report_deleted and not datahandling.is_false_positive(post_site_id[0:2]) and not \
datahandling.is_ignored_post(post_site_id[0:2]):

chatcommunicate._msg_queue.put((room, message_text))
chatcommunicate._msg_queue.put((room, message_text, report_data))
@@ -292,6 +292,7 @@ meta.stackexchange.com:
- 346854 # DonQuiKong
- 284336 # Catija
- 205533 # Videonauth
- 310369 # quartata


stackoverflow.com:
@@ -379,6 +380,7 @@ stackoverflow.com:
- 8242698 # user0042
- 3773011 # Makyen
- 2858773 # Ajay Brahmakshatriya
- 4766556 # quartata

111347: # SOBotics
commands: true

0 comments on commit d89fc9b

Please sign in to comment.
You can’t perform that action at this time.