)]}'
{"neutron/db/agents_db.py":[{"author":{"_account_id":5948,"name":"Oleg Bondarev","email":"obondarev@mirantis.com","username":"obondarev"},"change_message_id":"8abaeb9eba530dbc395f29afe90bec1cb78031f2","unresolved":false,"context_lines":[{"line_number":394,"context_line":"                agent_db \u003d Agent(**res)"},{"line_number":395,"context_line":"                greenthread.sleep(0)"},{"line_number":396,"context_line":"                context.session.add(agent_db)"},{"line_number":397,"context_line":"                event_type \u003d events.AFTER_CREATE"},{"line_number":398,"context_line":"                self._log_heartbeat(agent_state, agent_db, configurations_dict)"},{"line_number":399,"context_line":"                status \u003d n_const.AGENT_NEW"},{"line_number":400,"context_line":"            greenthread.sleep(0)"}],"source_content_type":"text/x-python","patch_set":1,"id":"7aa08908_1dcebc62","line":397,"range":{"start_line":397,"start_character":16,"end_line":397,"end_character":48},"updated":"2016-06-08 13:33:04.000000000","message":"why need two event types if have one handler for both?","commit_id":"16aa69588003e4a2b43978aaa5c760415b001c2e"},{"author":{"_account_id":11159,"name":"Hong Hui Xiao","email":"honghui_xiao@yeah.net","username":"HongHuiXiao"},"change_message_id":"c4b4f243c8eb0503fd43a86d406638acf65e5b10","unresolved":false,"context_lines":[{"line_number":394,"context_line":"                agent_db \u003d Agent(**res)"},{"line_number":395,"context_line":"                greenthread.sleep(0)"},{"line_number":396,"context_line":"                context.session.add(agent_db)"},{"line_number":397,"context_line":"                event_type \u003d events.AFTER_CREATE"},{"line_number":398,"context_line":"                self._log_heartbeat(agent_state, agent_db, configurations_dict)"},{"line_number":399,"context_line":"                status \u003d n_const.AGENT_NEW"},{"line_number":400,"context_line":"            greenthread.sleep(0)"}],"source_content_type":"text/x-python","patch_set":1,"id":"7aa08908_569f815e","line":397,"range":{"start_line":397,"start_character":16,"end_line":397,"end_character":48},"in_reply_to":"7aa08908_1dcebc62","updated":"2016-06-08 14:06:36.000000000","message":"I think there are 2 event types here, update and create. They can share one handler, as they used to do before this patch.","commit_id":"16aa69588003e4a2b43978aaa5c760415b001c2e"},{"author":{"_account_id":5948,"name":"Oleg Bondarev","email":"obondarev@mirantis.com","username":"obondarev"},"change_message_id":"e4133e59c8d0fffec39725b02d8d5c4ea1e331cd","unresolved":false,"context_lines":[{"line_number":394,"context_line":"                agent_db \u003d Agent(**res)"},{"line_number":395,"context_line":"                greenthread.sleep(0)"},{"line_number":396,"context_line":"                context.session.add(agent_db)"},{"line_number":397,"context_line":"                event_type \u003d events.AFTER_CREATE"},{"line_number":398,"context_line":"                self._log_heartbeat(agent_state, agent_db, configurations_dict)"},{"line_number":399,"context_line":"                status \u003d n_const.AGENT_NEW"},{"line_number":400,"context_line":"            greenthread.sleep(0)"}],"source_content_type":"text/x-python","patch_set":1,"id":"7aa08908_911e136e","line":397,"range":{"start_line":397,"start_character":16,"end_line":397,"end_character":48},"in_reply_to":"7aa08908_569f815e","updated":"2016-06-08 14:23:13.000000000","message":"Logically we\u0027re not creating segments to host mapping, we\u0027re just updating those mappings in both cases (either new agent or existing agent) so I believe one event_type should be enough. Let\u0027s not complicate code for no good reason","commit_id":"16aa69588003e4a2b43978aaa5c760415b001c2e"},{"author":{"_account_id":11159,"name":"Hong Hui Xiao","email":"honghui_xiao@yeah.net","username":"HongHuiXiao"},"change_message_id":"e728aadfbfff6eb95f411954502554ed3bfe3ea6","unresolved":false,"context_lines":[{"line_number":394,"context_line":"                agent_db \u003d Agent(**res)"},{"line_number":395,"context_line":"                greenthread.sleep(0)"},{"line_number":396,"context_line":"                context.session.add(agent_db)"},{"line_number":397,"context_line":"                event_type \u003d events.AFTER_CREATE"},{"line_number":398,"context_line":"                self._log_heartbeat(agent_state, agent_db, configurations_dict)"},{"line_number":399,"context_line":"                status \u003d n_const.AGENT_NEW"},{"line_number":400,"context_line":"            greenthread.sleep(0)"}],"source_content_type":"text/x-python","patch_set":1,"id":"7aa08908_e4007004","line":397,"range":{"start_line":397,"start_character":16,"end_line":397,"end_character":48},"in_reply_to":"7aa08908_911e136e","updated":"2016-06-08 15:05:05.000000000","message":"To be honest, I don\u0027t think it is good to do that way. Although only segment_host_map consume these event now, I don\u0027t want to make it to tight-coupling. From the agents_db side, it just sends out its event. It is up to the observers to decide how to handle the event. Your suggestion is good for the current segment_host_map case. But I think the notifier here should be general for all cases. What do you think?","commit_id":"16aa69588003e4a2b43978aaa5c760415b001c2e"},{"author":{"_account_id":7448,"name":"Carl Baldwin","email":"carl@ecbaldwin.net","username":"carl-baldwin"},"change_message_id":"512be43492489071b3fc7394430a79a0853c863d","unresolved":false,"context_lines":[{"line_number":394,"context_line":"                agent_db \u003d Agent(**res)"},{"line_number":395,"context_line":"                greenthread.sleep(0)"},{"line_number":396,"context_line":"                context.session.add(agent_db)"},{"line_number":397,"context_line":"                event_type \u003d events.AFTER_CREATE"},{"line_number":398,"context_line":"                self._log_heartbeat(agent_state, agent_db, configurations_dict)"},{"line_number":399,"context_line":"                status \u003d n_const.AGENT_NEW"},{"line_number":400,"context_line":"            greenthread.sleep(0)"}],"source_content_type":"text/x-python","patch_set":1,"id":"7aa08908_6b3d522a","line":397,"range":{"start_line":397,"start_character":16,"end_line":397,"end_character":48},"in_reply_to":"7aa08908_e4007004","updated":"2016-06-09 00:44:41.000000000","message":"I agree with @Hong Hui Xiao.  This code shouldn\u0027t know that the only current listener just happens to only care about one kind of event.  It really should be consistent with other events that are emitted for create and update distinctly.  It should be up to the listener to decide to collapse the two in to the same action.","commit_id":"16aa69588003e4a2b43978aaa5c760415b001c2e"},{"author":{"_account_id":5948,"name":"Oleg Bondarev","email":"obondarev@mirantis.com","username":"obondarev"},"change_message_id":"49017c45128aea0dfb2beca12935e336914f5db5","unresolved":false,"context_lines":[{"line_number":394,"context_line":"                agent_db \u003d Agent(**res)"},{"line_number":395,"context_line":"                greenthread.sleep(0)"},{"line_number":396,"context_line":"                context.session.add(agent_db)"},{"line_number":397,"context_line":"                event_type \u003d events.AFTER_CREATE"},{"line_number":398,"context_line":"                self._log_heartbeat(agent_state, agent_db, configurations_dict)"},{"line_number":399,"context_line":"                status \u003d n_const.AGENT_NEW"},{"line_number":400,"context_line":"            greenthread.sleep(0)"}],"source_content_type":"text/x-python","patch_set":1,"id":"7aa08908_cf60c8a7","line":397,"range":{"start_line":397,"start_character":16,"end_line":397,"end_character":48},"in_reply_to":"7aa08908_e4007004","updated":"2016-06-09 07:07:13.000000000","message":"for some reason I was thinking this is about events for segment-host mapping which would be \u0027update\u0027 in both cases, now I see that it\u0027s for agent resource, so yeah, I agree there should be 2 events - agent created and agent updated. Sorry.","commit_id":"16aa69588003e4a2b43978aaa5c760415b001c2e"}]}
