Mockbox icon indicating copy to clipboard operation
Mockbox copied to clipboard

WebSocket onclose() in python sometimes gets called twice

Open jkingsman opened this issue 9 years ago • 2 comments

If you take out the try/catch at https://github.com/jkingsman/Mockbox/blob/master/Web.py#L77, it appears that the connection list removal happens twice (and triggers an exception when you try to remove an element that doesn't exist). The try/catch is kludgy and a Bad Thing™; it's really just a band aid - what's more puzzling is why a terminal event listener is getting called more than once on the same object... What is Python thinking?

How is it feeling?

What have we done to each other?

What will we do?

jkingsman avatar Dec 24 '15 08:12 jkingsman

Dunno what it was, but it looks like migrating to a keyed dictionary on adea7d6 fixed the issue.

jkingsman avatar Dec 24 '15 20:12 jkingsman

Nevermind... just got lucky a few times. Bugs still exist. MAN THIS WOULD BE SO MUCH EASIER TO DEBUG IF THE CREATOR HAD WRITTEN A TEST SUITE WITH THIS. Oh. wait.

nvm.

jkingsman avatar Dec 24 '15 20:12 jkingsman