)]}'
{"docker/matrix-eavesdrop/src/eavesdrop/bot.py":[{"author":{"_account_id":1,"name":"James E. Blair","email":"jim@acmegating.com","username":"corvus"},"change_message_id":"ce7d88738bd7291cbe7d68af7dd9e28c926c6bdc","unresolved":false,"context_lines":[{"line_number":86,"context_line":"            \u0027access_token\u0027: token,"},{"line_number":87,"context_line":"        }"},{"line_number":88,"context_line":"        with open(self.cred_path, \u0027w\u0027) as f:"},{"line_number":89,"context_line":"            json.dump(data, f)"},{"line_number":90,"context_line":""},{"line_number":91,"context_line":"    def load_creds(self):"},{"line_number":92,"context_line":"        if os.path.exists(self.cred_path):"}],"source_content_type":"text/x-python","patch_set":5,"id":"a2f4ccf9_78bc6237","line":89,"updated":"2021-07-23 21:18:34.000000000","message":"No it\u0027s run-time data, saved in a var dir.  If we lose it, no big deal -- we\u0027ll just get a new matrix session.","commit_id":"f6eb5a44342a11ef661ff001d630ace64bc701fc"},{"author":{"_account_id":4146,"name":"Clark Boylan","email":"cboylan@sapwetik.org","username":"cboylan"},"change_message_id":"19f537e7789461cf3456577532e6011ed8e779d5","unresolved":true,"context_lines":[{"line_number":86,"context_line":"            \u0027access_token\u0027: token,"},{"line_number":87,"context_line":"        }"},{"line_number":88,"context_line":"        with open(self.cred_path, \u0027w\u0027) as f:"},{"line_number":89,"context_line":"            json.dump(data, f)"},{"line_number":90,"context_line":""},{"line_number":91,"context_line":"    def load_creds(self):"},{"line_number":92,"context_line":"        if os.path.exists(self.cred_path):"}],"source_content_type":"text/x-python","patch_set":5,"id":"451d78f6_d80571e2","line":89,"updated":"2021-07-23 21:02:56.000000000","message":"Will this fight with config management?","commit_id":"f6eb5a44342a11ef661ff001d630ace64bc701fc"},{"author":{"_account_id":4146,"name":"Clark Boylan","email":"cboylan@sapwetik.org","username":"cboylan"},"change_message_id":"d3b92551b004de45ea572add04b365acfda34af2","unresolved":true,"context_lines":[{"line_number":86,"context_line":"            \u0027access_token\u0027: token,"},{"line_number":87,"context_line":"        }"},{"line_number":88,"context_line":"        with open(self.cred_path, \u0027w\u0027) as f:"},{"line_number":89,"context_line":"            json.dump(data, f)"},{"line_number":90,"context_line":""},{"line_number":91,"context_line":"    def load_creds(self):"},{"line_number":92,"context_line":"        if os.path.exists(self.cred_path):"}],"source_content_type":"text/x-python","patch_set":5,"id":"a1c946b2_b951ba68","line":89,"in_reply_to":"451d78f6_d80571e2","updated":"2021-07-23 21:11:14.000000000","message":"This isn\u0027t managed by config management. This tracks session state locally and we only manage the yaml config file.","commit_id":"f6eb5a44342a11ef661ff001d630ace64bc701fc"},{"author":{"_account_id":1,"name":"James E. Blair","email":"jim@acmegating.com","username":"corvus"},"change_message_id":"8a36dcd7199688d5c41e42a658442448e53405c1","unresolved":false,"context_lines":[{"line_number":125,"context_line":"            room_path \u003d os.path.join(self.config[\u0027log_dir\u0027], room_path)"},{"line_number":126,"context_line":"        filename \u003d f\u0027{room_name}.{event_date}.log\u0027"},{"line_number":127,"context_line":"        logpath \u003d os.path.join(room_path, filename)"},{"line_number":128,"context_line":"        body \u003d event.body"},{"line_number":129,"context_line":"        line \u003d f\u0027{event_date}T{event_time}  \u003c{event.sender}\u003e {body}\\n\u0027"},{"line_number":130,"context_line":"        self.log.info(\u0027Logging %s %s\u0027, room.room_id, line[:-1])"},{"line_number":131,"context_line":"        with open(logpath, \u0027a\u0027) as f:"}],"source_content_type":"text/x-python","patch_set":5,"id":"0f5921b5_55cbf848","line":128,"updated":"2021-07-16 15:51:20.000000000","message":"[nit] Sure but doesn\u0027t hurt.","commit_id":"f6eb5a44342a11ef661ff001d630ace64bc701fc"},{"author":{"_account_id":7118,"name":"Ian Wienand","email":"iwienand@redhat.com","username":"iwienand"},"change_message_id":"8e5f670a61d7f542a978e50b2a8d2d024f52c18c","unresolved":true,"context_lines":[{"line_number":125,"context_line":"            room_path \u003d os.path.join(self.config[\u0027log_dir\u0027], room_path)"},{"line_number":126,"context_line":"        filename \u003d f\u0027{room_name}.{event_date}.log\u0027"},{"line_number":127,"context_line":"        logpath \u003d os.path.join(room_path, filename)"},{"line_number":128,"context_line":"        body \u003d event.body"},{"line_number":129,"context_line":"        line \u003d f\u0027{event_date}T{event_time}  \u003c{event.sender}\u003e {body}\\n\u0027"},{"line_number":130,"context_line":"        self.log.info(\u0027Logging %s %s\u0027, room.room_id, line[:-1])"},{"line_number":131,"context_line":"        with open(logpath, \u0027a\u0027) as f:"}],"source_content_type":"text/x-python","patch_set":5,"id":"5eeb1a25_e4390d9e","line":128,"range":{"start_line":128,"start_character":8,"end_line":128,"end_character":25},"updated":"2021-07-12 07:28:14.000000000","message":"not needed?","commit_id":"f6eb5a44342a11ef661ff001d630ace64bc701fc"},{"author":{"_account_id":4146,"name":"Clark Boylan","email":"cboylan@sapwetik.org","username":"cboylan"},"change_message_id":"19f537e7789461cf3456577532e6011ed8e779d5","unresolved":false,"context_lines":[{"line_number":125,"context_line":"            room_path \u003d os.path.join(self.config[\u0027log_dir\u0027], room_path)"},{"line_number":126,"context_line":"        filename \u003d f\u0027{room_name}.{event_date}.log\u0027"},{"line_number":127,"context_line":"        logpath \u003d os.path.join(room_path, filename)"},{"line_number":128,"context_line":"        body \u003d event.body"},{"line_number":129,"context_line":"        line \u003d f\u0027{event_date}T{event_time}  \u003c{event.sender}\u003e {body}\\n\u0027"},{"line_number":130,"context_line":"        self.log.info(\u0027Logging %s %s\u0027, room.room_id, line[:-1])"},{"line_number":131,"context_line":"        with open(logpath, \u0027a\u0027) as f:"}],"source_content_type":"text/x-python","patch_set":5,"id":"59c9270b_d6deb540","line":128,"in_reply_to":"0f5921b5_55cbf848","updated":"2021-07-23 21:02:56.000000000","message":"Seems used below and helps keep the line shorter?","commit_id":"f6eb5a44342a11ef661ff001d630ace64bc701fc"},{"author":{"_account_id":7118,"name":"Ian Wienand","email":"iwienand@redhat.com","username":"iwienand"},"change_message_id":"8e5f670a61d7f542a978e50b2a8d2d024f52c18c","unresolved":true,"context_lines":[{"line_number":126,"context_line":"        filename \u003d f\u0027{room_name}.{event_date}.log\u0027"},{"line_number":127,"context_line":"        logpath \u003d os.path.join(room_path, filename)"},{"line_number":128,"context_line":"        body \u003d event.body"},{"line_number":129,"context_line":"        line \u003d f\u0027{event_date}T{event_time}  \u003c{event.sender}\u003e {body}\\n\u0027"},{"line_number":130,"context_line":"        self.log.info(\u0027Logging %s %s\u0027, room.room_id, line[:-1])"},{"line_number":131,"context_line":"        with open(logpath, \u0027a\u0027) as f:"},{"line_number":132,"context_line":"            f.write(line)"}],"source_content_type":"text/x-python","patch_set":5,"id":"9ce4558d_6e314aac","line":129,"range":{"start_line":129,"start_character":61,"end_line":129,"end_character":67},"updated":"2021-07-12 07:28:14.000000000","message":"From what i can tell of matrix-nio {body} is plain-text of what was written [1]?  i feel like if we are exposing this file to web browsers we need to be careful to escape what we write here.\n\n[1] https://matrix-nio.readthedocs.io/en/latest/nio.html#nio.events.room_events.RoomMessageText","commit_id":"f6eb5a44342a11ef661ff001d630ace64bc701fc"},{"author":{"_account_id":1,"name":"James E. Blair","email":"jim@acmegating.com","username":"corvus"},"change_message_id":"8a36dcd7199688d5c41e42a658442448e53405c1","unresolved":false,"context_lines":[{"line_number":126,"context_line":"        filename \u003d f\u0027{room_name}.{event_date}.log\u0027"},{"line_number":127,"context_line":"        logpath \u003d os.path.join(room_path, filename)"},{"line_number":128,"context_line":"        body \u003d event.body"},{"line_number":129,"context_line":"        line \u003d f\u0027{event_date}T{event_time}  \u003c{event.sender}\u003e {body}\\n\u0027"},{"line_number":130,"context_line":"        self.log.info(\u0027Logging %s %s\u0027, room.room_id, line[:-1])"},{"line_number":131,"context_line":"        with open(logpath, \u0027a\u0027) as f:"},{"line_number":132,"context_line":"            f.write(line)"}],"source_content_type":"text/x-python","patch_set":5,"id":"af018754_d6822764","line":129,"updated":"2021-07-16 15:51:20.000000000","message":"This isn\u0027t writing an HTML file, it\u0027s writing a plain text log.  There\u0027s a separate program that converts plain text to html.  It\u0027s the responsibility of that program to escape for web browsers.","commit_id":"f6eb5a44342a11ef661ff001d630ace64bc701fc"},{"author":{"_account_id":1,"name":"James E. Blair","email":"jim@acmegating.com","username":"corvus"},"change_message_id":"8a36dcd7199688d5c41e42a658442448e53405c1","unresolved":false,"context_lines":[{"line_number":128,"context_line":"        body \u003d event.body"},{"line_number":129,"context_line":"        line \u003d f\u0027{event_date}T{event_time}  \u003c{event.sender}\u003e {body}\\n\u0027"},{"line_number":130,"context_line":"        self.log.info(\u0027Logging %s %s\u0027, room.room_id, line[:-1])"},{"line_number":131,"context_line":"        with open(logpath, \u0027a\u0027) as f:"},{"line_number":132,"context_line":"            f.write(line)"},{"line_number":133,"context_line":""},{"line_number":134,"context_line":"    async def run(self):"}],"source_content_type":"text/x-python","patch_set":5,"id":"718d1aa0_42819aad","line":131,"updated":"2021-07-16 15:51:20.000000000","message":"Unless nio does something very unexpected with threads (and it doesn\u0027t as far as I can see), the asyncio event loop will not regain control until this method is complete because there is no await within this function to yield.","commit_id":"f6eb5a44342a11ef661ff001d630ace64bc701fc"},{"author":{"_account_id":7118,"name":"Ian Wienand","email":"iwienand@redhat.com","username":"iwienand"},"change_message_id":"8e5f670a61d7f542a978e50b2a8d2d024f52c18c","unresolved":true,"context_lines":[{"line_number":128,"context_line":"        body \u003d event.body"},{"line_number":129,"context_line":"        line \u003d f\u0027{event_date}T{event_time}  \u003c{event.sender}\u003e {body}\\n\u0027"},{"line_number":130,"context_line":"        self.log.info(\u0027Logging %s %s\u0027, room.room_id, line[:-1])"},{"line_number":131,"context_line":"        with open(logpath, \u0027a\u0027) as f:"},{"line_number":132,"context_line":"            f.write(line)"},{"line_number":133,"context_line":""},{"line_number":134,"context_line":"    async def run(self):"}],"source_content_type":"text/x-python","patch_set":5,"id":"87e4a705_6b4db081","line":131,"updated":"2021-07-12 07:28:14.000000000","message":"the async suggests this might be run in parallel, which I think makes this unsafe.  \n\nFrom a quick look at the source I\u0027m not sure if this actually gets sequentalised as the client reads a sync response and loops through things basically await() each call.\n\ni feel like putting messages into a queue that is drained by a separate process/whatever for writing might be a better approach for scalability of this.","commit_id":"f6eb5a44342a11ef661ff001d630ace64bc701fc"},{"author":{"_account_id":4146,"name":"Clark Boylan","email":"cboylan@sapwetik.org","username":"cboylan"},"change_message_id":"19f537e7789461cf3456577532e6011ed8e779d5","unresolved":false,"context_lines":[{"line_number":128,"context_line":"        body \u003d event.body"},{"line_number":129,"context_line":"        line \u003d f\u0027{event_date}T{event_time}  \u003c{event.sender}\u003e {body}\\n\u0027"},{"line_number":130,"context_line":"        self.log.info(\u0027Logging %s %s\u0027, room.room_id, line[:-1])"},{"line_number":131,"context_line":"        with open(logpath, \u0027a\u0027) as f:"},{"line_number":132,"context_line":"            f.write(line)"},{"line_number":133,"context_line":""},{"line_number":134,"context_line":"    async def run(self):"}],"source_content_type":"text/x-python","patch_set":5,"id":"443f47cd_480c99ed","line":131,"in_reply_to":"718d1aa0_42819aad","updated":"2021-07-23 21:02:56.000000000","message":"Correct, and you would need to use something like aiofiles to combine asyncio with file io.","commit_id":"f6eb5a44342a11ef661ff001d630ace64bc701fc"},{"author":{"_account_id":1,"name":"James E. Blair","email":"jim@acmegating.com","username":"corvus"},"change_message_id":"ce7d88738bd7291cbe7d68af7dd9e28c926c6bdc","unresolved":false,"context_lines":[{"line_number":136,"context_line":"        await self.join_rooms()"},{"line_number":137,"context_line":"        self.client.add_event_callback(self.message_callback, RoomMessageText)"},{"line_number":138,"context_line":"        try:"},{"line_number":139,"context_line":"            await self.client.sync_forever(timeout\u003d30000, full_state\u003dTrue)"},{"line_number":140,"context_line":"        finally:"},{"line_number":141,"context_line":"            await self.client.close()"},{"line_number":142,"context_line":""}],"source_content_type":"text/x-python","patch_set":5,"id":"55c189aa_292863f4","line":139,"updated":"2021-07-23 21:18:34.000000000","message":"It\u0027s not important because we\u0027ll get the complete state when we reconnect (we won\u0027t ever lose a log line no matter what we do here).  A slower timeout means we can avoid hammering the server in case of problems.","commit_id":"f6eb5a44342a11ef661ff001d630ace64bc701fc"},{"author":{"_account_id":4146,"name":"Clark Boylan","email":"cboylan@sapwetik.org","username":"cboylan"},"change_message_id":"19f537e7789461cf3456577532e6011ed8e779d5","unresolved":true,"context_lines":[{"line_number":136,"context_line":"        await self.join_rooms()"},{"line_number":137,"context_line":"        self.client.add_event_callback(self.message_callback, RoomMessageText)"},{"line_number":138,"context_line":"        try:"},{"line_number":139,"context_line":"            await self.client.sync_forever(timeout\u003d30000, full_state\u003dTrue)"},{"line_number":140,"context_line":"        finally:"},{"line_number":141,"context_line":"            await self.client.close()"},{"line_number":142,"context_line":""}],"source_content_type":"text/x-python","patch_set":5,"id":"0e45bcdf_662e3de3","line":139,"range":{"start_line":139,"start_character":43,"end_line":139,"end_character":56},"updated":"2021-07-23 21:02:56.000000000","message":"Would a smaller timeout make sense to catch network problems?","commit_id":"f6eb5a44342a11ef661ff001d630ace64bc701fc"},{"author":{"_account_id":1,"name":"James E. Blair","email":"jim@acmegating.com","username":"corvus"},"change_message_id":"ce7d88738bd7291cbe7d68af7dd9e28c926c6bdc","unresolved":false,"context_lines":[{"line_number":145,"context_line":"    while True:"},{"line_number":146,"context_line":"        bot \u003d Bot()"},{"line_number":147,"context_line":"        await bot.run()"},{"line_number":148,"context_line":"        time.sleep(10)"},{"line_number":149,"context_line":""},{"line_number":150,"context_line":""},{"line_number":151,"context_line":"def main():"}],"source_content_type":"text/x-python","patch_set":5,"id":"f62fe57e_c788cbb7","line":148,"updated":"2021-07-23 21:18:34.000000000","message":"Either way -- this is going to raise an exception and exit -- maybe we should s/finally/except/ in your example and retry forever?","commit_id":"f6eb5a44342a11ef661ff001d630ace64bc701fc"},{"author":{"_account_id":4146,"name":"Clark Boylan","email":"cboylan@sapwetik.org","username":"cboylan"},"change_message_id":"19f537e7789461cf3456577532e6011ed8e779d5","unresolved":true,"context_lines":[{"line_number":145,"context_line":"    while True:"},{"line_number":146,"context_line":"        bot \u003d Bot()"},{"line_number":147,"context_line":"        await bot.run()"},{"line_number":148,"context_line":"        time.sleep(10)"},{"line_number":149,"context_line":""},{"line_number":150,"context_line":""},{"line_number":151,"context_line":"def main():"}],"source_content_type":"text/x-python","patch_set":5,"id":"7ab2ddf3_c52ec535","line":148,"updated":"2021-07-23 21:02:56.000000000","message":"I think this sleep here makes sense if we want a delay before trying to reconnect. However, would an exception be raised here if there was a problem that caused it to disconnect? Might put do this more defensively like:\n\n  while True:\n    try:\n      bot \u003d Bot()\n      await bot.run()\n    finally:\n      time.sleep(10)","commit_id":"f6eb5a44342a11ef661ff001d630ace64bc701fc"},{"author":{"_account_id":4146,"name":"Clark Boylan","email":"cboylan@sapwetik.org","username":"cboylan"},"change_message_id":"c2aec07517e15cf0b026ebb3a248f5b48d0680d3","unresolved":false,"context_lines":[{"line_number":145,"context_line":"    while True:"},{"line_number":146,"context_line":"        bot \u003d Bot()"},{"line_number":147,"context_line":"        await bot.run()"},{"line_number":148,"context_line":"        time.sleep(10)"},{"line_number":149,"context_line":""},{"line_number":150,"context_line":""},{"line_number":151,"context_line":"def main():"}],"source_content_type":"text/x-python","patch_set":5,"id":"846c3b29_ea6bfe3c","line":148,"in_reply_to":"f62fe57e_c788cbb7","updated":"2021-07-23 21:22:49.000000000","message":"Ya I think if we can more gracefully handle client errors and avoid having docker restart things for us that would be great. s/finally/except/ works for me. Then I guess if it is a non exception await return we\u0027d exit normally.","commit_id":"f6eb5a44342a11ef661ff001d630ace64bc701fc"}]}
