Closed codyswanner closed 2 months ago
This gets problematic for the update_tags method, which calls other methods based on changes made, and theoretically can call more than one of these methods at a time. If these methods are all going to return back and then be funneled into send_response, what is a good way to ensure that all the necessary messages get passed to send_response, and how can it send more than one message if needed? (Pack response messages into an array?)
Commit c1336f8 implements this.
Currently, methods of FilterConsumer that need to send a response WebSocket message to the frontend are doing so inside each method. This is somewhat awkward, as most of these functions does not include a return statement. This makes it especially awkward to handle testing (which I am finally working on, huzzah).
A better system would be to have each of these methods return the message to be sent, that can then be passed to a "send_message" method. This will change all of these "side effect" messages being sent to actual return statements, and greatly simplify documentation and testing. This will also help by specifying each method to be doing only the thing in it's name (such as "update_tags" or "delete_image") instead of doing it's primary function, and also a secondary purpose of sending a websocket message.