)]}'
{"/COMMIT_MSG":[{"author":{"_account_id":2813,"name":"Mehdi Abaakouk","email":"sileht@sileht.net","username":"sileht"},"change_message_id":"15ef14d1a6f04c46954effd684159afdd1025f99","unresolved":false,"context_lines":[{"line_number":4,"context_line":"Commit:     Darren Hague \u003cd.hague@sap.com\u003e"},{"line_number":5,"context_line":"CommitDate: 2016-07-11 09:49:53 +0100"},{"line_number":6,"context_line":""},{"line_number":7,"context_line":"Add ability to hand off event sending to a queue processed by a background thread so  as not to block swift proxy"},{"line_number":8,"context_line":""},{"line_number":9,"context_line":"Change-Id: I3da2b88b2bc9b7fd8c572a0085fa1d78c4f54701"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":5,"id":"1aa78d24_b0ebb277","line":7,"updated":"2016-07-11 09:03:38.000000000","message":"The commit message should follow some convention:\n\nhttps://wiki.openstack.org/wiki/GitCommitMessages#Summary_of_Git_commit_message_structure","commit_id":"b2a022f5470790e6dee2f7f9f89d5f5fbf59f5c0"}],"ceilometermiddleware/swift.py":[{"author":{"_account_id":12807,"name":"Steve Lewis (stevelle)","email":"stevelle@gmail.com","username":"stevelle"},"change_message_id":"6171a55872e9aa10fe8b41d5e1ebfad397c574f3","unresolved":false,"context_lines":[{"line_number":106,"context_line":"class Swift(object):"},{"line_number":107,"context_line":"    \"\"\"Swift middleware used for counting requests.\"\"\""},{"line_number":108,"context_line":""},{"line_number":109,"context_line":"    def __init__(self, app, conf, event_sent\u003dNone):"},{"line_number":110,"context_line":"        self._app \u003d app"},{"line_number":111,"context_line":"        self.ignore_projects \u003d ["},{"line_number":112,"context_line":"            proj.strip() for proj in"}],"source_content_type":"text/x-python","patch_set":2,"id":"3aaa91ec_649dd565","line":109,"updated":"2016-07-01 17:21:24.000000000","message":"What is event_sent? How is this valuable?\nNeeds an explanation in the class docstring.","commit_id":"266dd65a76a01d84a6bf67e5b652b189e1156557"},{"author":{"_account_id":14768,"name":"Darren Hague","email":"d.hague@sap.com","username":"dhague"},"change_message_id":"b4e010e479dd856e5820b7b58b1ddb34fb8f11dc","unresolved":false,"context_lines":[{"line_number":106,"context_line":"class Swift(object):"},{"line_number":107,"context_line":"    \"\"\"Swift middleware used for counting requests.\"\"\""},{"line_number":108,"context_line":""},{"line_number":109,"context_line":"    def __init__(self, app, conf, event_sent\u003dNone):"},{"line_number":110,"context_line":"        self._app \u003d app"},{"line_number":111,"context_line":"        self.ignore_projects \u003d ["},{"line_number":112,"context_line":"            proj.strip() for proj in"}],"source_content_type":"text/x-python","patch_set":2,"id":"1aa78d24_f1f0d7cb","line":109,"in_reply_to":"3aaa91ec_649dd565","updated":"2016-07-08 15:41:55.000000000","message":"Done","commit_id":"266dd65a76a01d84a6bf67e5b652b189e1156557"},{"author":{"_account_id":12807,"name":"Steve Lewis (stevelle)","email":"stevelle@gmail.com","username":"stevelle"},"change_message_id":"6171a55872e9aa10fe8b41d5e1ebfad397c574f3","unresolved":false,"context_lines":[{"line_number":129,"context_line":"        if self.reseller_prefix and self.reseller_prefix[-1] !\u003d \u0027_\u0027:"},{"line_number":130,"context_line":"            self.reseller_prefix +\u003d \u0027_\u0027"},{"line_number":131,"context_line":""},{"line_number":132,"context_line":"        _LOG.setLevel(getattr(logging, conf.get(\u0027log_level\u0027, \u0027WARNING\u0027)))"},{"line_number":133,"context_line":""},{"line_number":134,"context_line":"        # Configure nonblocking_notify as True to send in a background thread"},{"line_number":135,"context_line":"        #"}],"source_content_type":"text/x-python","patch_set":2,"id":"3aaa91ec_848e012c","line":132,"updated":"2016-07-01 17:21:24.000000000","message":"Need to document this new option in the file docstring above.","commit_id":"266dd65a76a01d84a6bf67e5b652b189e1156557"},{"author":{"_account_id":14768,"name":"Darren Hague","email":"d.hague@sap.com","username":"dhague"},"change_message_id":"b4e010e479dd856e5820b7b58b1ddb34fb8f11dc","unresolved":false,"context_lines":[{"line_number":129,"context_line":"        if self.reseller_prefix and self.reseller_prefix[-1] !\u003d \u0027_\u0027:"},{"line_number":130,"context_line":"            self.reseller_prefix +\u003d \u0027_\u0027"},{"line_number":131,"context_line":""},{"line_number":132,"context_line":"        _LOG.setLevel(getattr(logging, conf.get(\u0027log_level\u0027, \u0027WARNING\u0027)))"},{"line_number":133,"context_line":""},{"line_number":134,"context_line":"        # Configure nonblocking_notify as True to send in a background thread"},{"line_number":135,"context_line":"        #"}],"source_content_type":"text/x-python","patch_set":2,"id":"1aa78d24_513f2bd6","line":132,"in_reply_to":"3aaa91ec_848e012c","updated":"2016-07-08 15:41:55.000000000","message":"Done","commit_id":"266dd65a76a01d84a6bf67e5b652b189e1156557"},{"author":{"_account_id":12807,"name":"Steve Lewis (stevelle)","email":"stevelle@gmail.com","username":"stevelle"},"change_message_id":"6171a55872e9aa10fe8b41d5e1ebfad397c574f3","unresolved":false,"context_lines":[{"line_number":139,"context_line":"        # For backward compatibility, default to False and therefore wait for"},{"line_number":140,"context_line":"        #  sending to complete. This causes swift proxy to hang if the"},{"line_number":141,"context_line":"        #  destination is unavailable"},{"line_number":142,"context_line":"        self.nonblocking_notify \u003d conf.get(\u0027nonblocking_notify\u0027, False)"},{"line_number":143,"context_line":"        if self.nonblocking_notify:"},{"line_number":144,"context_line":"            # threading.Event to set when background sending is complete"},{"line_number":145,"context_line":"            self.event_sent \u003d event_sent"}],"source_content_type":"text/x-python","patch_set":2,"id":"3aaa91ec_04a21199","line":142,"updated":"2016-07-01 17:21:24.000000000","message":"Need to document this new option in the file docstring above.","commit_id":"266dd65a76a01d84a6bf67e5b652b189e1156557"},{"author":{"_account_id":14768,"name":"Darren Hague","email":"d.hague@sap.com","username":"dhague"},"change_message_id":"b4e010e479dd856e5820b7b58b1ddb34fb8f11dc","unresolved":false,"context_lines":[{"line_number":139,"context_line":"        # For backward compatibility, default to False and therefore wait for"},{"line_number":140,"context_line":"        #  sending to complete. This causes swift proxy to hang if the"},{"line_number":141,"context_line":"        #  destination is unavailable"},{"line_number":142,"context_line":"        self.nonblocking_notify \u003d conf.get(\u0027nonblocking_notify\u0027, False)"},{"line_number":143,"context_line":"        if self.nonblocking_notify:"},{"line_number":144,"context_line":"            # threading.Event to set when background sending is complete"},{"line_number":145,"context_line":"            self.event_sent \u003d event_sent"}],"source_content_type":"text/x-python","patch_set":2,"id":"1aa78d24_3117ff55","line":142,"in_reply_to":"3aaa91ec_04a21199","updated":"2016-07-08 15:41:55.000000000","message":"Done","commit_id":"266dd65a76a01d84a6bf67e5b652b189e1156557"},{"author":{"_account_id":12807,"name":"Steve Lewis (stevelle)","email":"stevelle@gmail.com","username":"stevelle"},"change_message_id":"6171a55872e9aa10fe8b41d5e1ebfad397c574f3","unresolved":false,"context_lines":[{"line_number":148,"context_line":"            try:"},{"line_number":149,"context_line":"                Swift.event_queue"},{"line_number":150,"context_line":"            except AttributeError:"},{"line_number":151,"context_line":"                Swift.event_queue \u003d Queue(int(conf.get(\u0027send_queue_size\u0027, 0)))"},{"line_number":152,"context_line":"                self.init_sender_thread()"},{"line_number":153,"context_line":"                _LOG.debug(\u0027Started sender thread\u0027)"},{"line_number":154,"context_line":""}],"source_content_type":"text/x-python","patch_set":2,"id":"3aaa91ec_c484890c","line":151,"updated":"2016-07-01 17:21:24.000000000","message":"Need to document this new option in the file docstring above.\n\nThe queue really should be bounded as well or the proxy server will behave badly without explanation, so a non-zero default should be used. How about 1000?","commit_id":"266dd65a76a01d84a6bf67e5b652b189e1156557"},{"author":{"_account_id":14768,"name":"Darren Hague","email":"d.hague@sap.com","username":"dhague"},"change_message_id":"b4e010e479dd856e5820b7b58b1ddb34fb8f11dc","unresolved":false,"context_lines":[{"line_number":148,"context_line":"            try:"},{"line_number":149,"context_line":"                Swift.event_queue"},{"line_number":150,"context_line":"            except AttributeError:"},{"line_number":151,"context_line":"                Swift.event_queue \u003d Queue(int(conf.get(\u0027send_queue_size\u0027, 0)))"},{"line_number":152,"context_line":"                self.init_sender_thread()"},{"line_number":153,"context_line":"                _LOG.debug(\u0027Started sender thread\u0027)"},{"line_number":154,"context_line":""}],"source_content_type":"text/x-python","patch_set":2,"id":"1aa78d24_d102fb0a","line":151,"in_reply_to":"3aaa91ec_c484890c","updated":"2016-07-08 15:41:55.000000000","message":"Done","commit_id":"266dd65a76a01d84a6bf67e5b652b189e1156557"},{"author":{"_account_id":12807,"name":"Steve Lewis (stevelle)","email":"stevelle@gmail.com","username":"stevelle"},"change_message_id":"6171a55872e9aa10fe8b41d5e1ebfad397c574f3","unresolved":false,"context_lines":[{"line_number":158,"context_line":""},{"line_number":159,"context_line":"    @staticmethod"},{"line_number":160,"context_line":"    def stop_sender_thread():"},{"line_number":161,"context_line":"        # A \"None\" event signals the sender thread to terminate"},{"line_number":162,"context_line":"        Swift.event_queue.put((None, None))"},{"line_number":163,"context_line":""},{"line_number":164,"context_line":"    def __call__(self, env, start_response):"}],"source_content_type":"text/x-python","patch_set":2,"id":"3aaa91ec_8466014f","line":161,"updated":"2016-07-01 17:21:24.000000000","message":"... \"signals the sender thread to terminate when all events are delivered.\"","commit_id":"266dd65a76a01d84a6bf67e5b652b189e1156557"},{"author":{"_account_id":14768,"name":"Darren Hague","email":"d.hague@sap.com","username":"dhague"},"change_message_id":"b4e010e479dd856e5820b7b58b1ddb34fb8f11dc","unresolved":false,"context_lines":[{"line_number":158,"context_line":""},{"line_number":159,"context_line":"    @staticmethod"},{"line_number":160,"context_line":"    def stop_sender_thread():"},{"line_number":161,"context_line":"        # A \"None\" event signals the sender thread to terminate"},{"line_number":162,"context_line":"        Swift.event_queue.put((None, None))"},{"line_number":163,"context_line":""},{"line_number":164,"context_line":"    def __call__(self, env, start_response):"}],"source_content_type":"text/x-python","patch_set":2,"id":"1aa78d24_ac47161c","line":161,"in_reply_to":"3aaa91ec_8466014f","updated":"2016-07-08 15:41:55.000000000","message":"Removed now, as daemon\u003dtrue does the job nicely.","commit_id":"266dd65a76a01d84a6bf67e5b652b189e1156557"},{"author":{"_account_id":12807,"name":"Steve Lewis (stevelle)","email":"stevelle@gmail.com","username":"stevelle"},"change_message_id":"6171a55872e9aa10fe8b41d5e1ebfad397c574f3","unresolved":false,"context_lines":[{"line_number":159,"context_line":"    @staticmethod"},{"line_number":160,"context_line":"    def stop_sender_thread():"},{"line_number":161,"context_line":"        # A \"None\" event signals the sender thread to terminate"},{"line_number":162,"context_line":"        Swift.event_queue.put((None, None))"},{"line_number":163,"context_line":""},{"line_number":164,"context_line":"    def __call__(self, env, start_response):"},{"line_number":165,"context_line":"        start_response_args \u003d [None]"}],"source_content_type":"text/x-python","patch_set":2,"id":"3aaa91ec_a253bfe1","line":162,"updated":"2016-07-01 17:21:24.000000000","message":"This has the same issue as line 288 below","commit_id":"266dd65a76a01d84a6bf67e5b652b189e1156557"},{"author":{"_account_id":14768,"name":"Darren Hague","email":"d.hague@sap.com","username":"dhague"},"change_message_id":"b4e010e479dd856e5820b7b58b1ddb34fb8f11dc","unresolved":false,"context_lines":[{"line_number":159,"context_line":"    @staticmethod"},{"line_number":160,"context_line":"    def stop_sender_thread():"},{"line_number":161,"context_line":"        # A \"None\" event signals the sender thread to terminate"},{"line_number":162,"context_line":"        Swift.event_queue.put((None, None))"},{"line_number":163,"context_line":""},{"line_number":164,"context_line":"    def __call__(self, env, start_response):"},{"line_number":165,"context_line":"        start_response_args \u003d [None]"}],"source_content_type":"text/x-python","patch_set":2,"id":"1aa78d24_0c9f4a60","line":162,"in_reply_to":"3aaa91ec_a253bfe1","updated":"2016-07-08 15:41:55.000000000","message":"Removed now - see previous comment.","commit_id":"266dd65a76a01d84a6bf67e5b652b189e1156557"},{"author":{"_account_id":12807,"name":"Steve Lewis (stevelle)","email":"stevelle@gmail.com","username":"stevelle"},"change_message_id":"6171a55872e9aa10fe8b41d5e1ebfad397c574f3","unresolved":false,"context_lines":[{"line_number":285,"context_line":""},{"line_number":286,"context_line":"        if self.nonblocking_notify:"},{"line_number":287,"context_line":"            try:"},{"line_number":288,"context_line":"                Swift.event_queue.put((event, self.event_sent))"},{"line_number":289,"context_line":"                _LOG.debug(\u0027Event %s added to send queue\u0027, event.id)"},{"line_number":290,"context_line":"            except Full:"},{"line_number":291,"context_line":"                _LOG.error(\u0027Send queue is FULL: Event %s not added\u0027, event.id)"}],"source_content_type":"text/x-python","patch_set":2,"id":"3aaa91ec_e3eed889","line":288,"updated":"2016-07-01 17:21:24.000000000","message":"This put is a blocking call and will never raise Full. Use put_nowait or put((event, self.event_sent), False)","commit_id":"266dd65a76a01d84a6bf67e5b652b189e1156557"},{"author":{"_account_id":14768,"name":"Darren Hague","email":"d.hague@sap.com","username":"dhague"},"change_message_id":"b4e010e479dd856e5820b7b58b1ddb34fb8f11dc","unresolved":false,"context_lines":[{"line_number":285,"context_line":""},{"line_number":286,"context_line":"        if self.nonblocking_notify:"},{"line_number":287,"context_line":"            try:"},{"line_number":288,"context_line":"                Swift.event_queue.put((event, self.event_sent))"},{"line_number":289,"context_line":"                _LOG.debug(\u0027Event %s added to send queue\u0027, event.id)"},{"line_number":290,"context_line":"            except Full:"},{"line_number":291,"context_line":"                _LOG.error(\u0027Send queue is FULL: Event %s not added\u0027, event.id)"}],"source_content_type":"text/x-python","patch_set":2,"id":"1aa78d24_ec72be48","line":288,"in_reply_to":"3aaa91ec_e3eed889","updated":"2016-07-08 15:41:55.000000000","message":"Done","commit_id":"266dd65a76a01d84a6bf67e5b652b189e1156557"},{"author":{"_account_id":12807,"name":"Steve Lewis (stevelle)","email":"stevelle@gmail.com","username":"stevelle"},"change_message_id":"6171a55872e9aa10fe8b41d5e1ebfad397c574f3","unresolved":false,"context_lines":[{"line_number":288,"context_line":"                Swift.event_queue.put((event, self.event_sent))"},{"line_number":289,"context_line":"                _LOG.debug(\u0027Event %s added to send queue\u0027, event.id)"},{"line_number":290,"context_line":"            except Full:"},{"line_number":291,"context_line":"                _LOG.error(\u0027Send queue is FULL: Event %s not added\u0027, event.id)"},{"line_number":292,"context_line":"                return"},{"line_number":293,"context_line":""},{"line_number":294,"context_line":"            # Ensure we have a worker thread"}],"source_content_type":"text/x-python","patch_set":2,"id":"3aaa91ec_1ffb7ac2","line":291,"updated":"2016-07-01 17:21:24.000000000","message":"I feel like this should be warning instead of error. (See http://specs.openstack.org/openstack/openstack-specs/specs/log-guidelines.html for why)","commit_id":"266dd65a76a01d84a6bf67e5b652b189e1156557"},{"author":{"_account_id":14768,"name":"Darren Hague","email":"d.hague@sap.com","username":"dhague"},"change_message_id":"b4e010e479dd856e5820b7b58b1ddb34fb8f11dc","unresolved":false,"context_lines":[{"line_number":288,"context_line":"                Swift.event_queue.put((event, self.event_sent))"},{"line_number":289,"context_line":"                _LOG.debug(\u0027Event %s added to send queue\u0027, event.id)"},{"line_number":290,"context_line":"            except Full:"},{"line_number":291,"context_line":"                _LOG.error(\u0027Send queue is FULL: Event %s not added\u0027, event.id)"},{"line_number":292,"context_line":"                return"},{"line_number":293,"context_line":""},{"line_number":294,"context_line":"            # Ensure we have a worker thread"}],"source_content_type":"text/x-python","patch_set":2,"id":"1aa78d24_6c39ae41","line":291,"in_reply_to":"3aaa91ec_1ffb7ac2","updated":"2016-07-08 15:41:55.000000000","message":"Done","commit_id":"266dd65a76a01d84a6bf67e5b652b189e1156557"},{"author":{"_account_id":12807,"name":"Steve Lewis (stevelle)","email":"stevelle@gmail.com","username":"stevelle"},"change_message_id":"6171a55872e9aa10fe8b41d5e1ebfad397c574f3","unresolved":false,"context_lines":[{"line_number":304,"context_line":""},{"line_number":305,"context_line":"    def __init__(self, notifier):"},{"line_number":306,"context_line":"        super(SendEventThread, self).__init__()"},{"line_number":307,"context_line":"        self.notifier \u003d notifier"},{"line_number":308,"context_line":""},{"line_number":309,"context_line":"    def run(self):"},{"line_number":310,"context_line":"        \"\"\"Send events without blocking swift proxy.\"\"\""}],"source_content_type":"text/x-python","patch_set":2,"id":"3aaa91ec_636e6830","line":307,"updated":"2016-07-01 17:21:24.000000000","message":"You should probably add self.setDaemon(True) here OR you need another way to invoke stop_sender_thread so that this shuts down cleanly.","commit_id":"266dd65a76a01d84a6bf67e5b652b189e1156557"},{"author":{"_account_id":14768,"name":"Darren Hague","email":"d.hague@sap.com","username":"dhague"},"change_message_id":"b4e010e479dd856e5820b7b58b1ddb34fb8f11dc","unresolved":false,"context_lines":[{"line_number":304,"context_line":""},{"line_number":305,"context_line":"    def __init__(self, notifier):"},{"line_number":306,"context_line":"        super(SendEventThread, self).__init__()"},{"line_number":307,"context_line":"        self.notifier \u003d notifier"},{"line_number":308,"context_line":""},{"line_number":309,"context_line":"    def run(self):"},{"line_number":310,"context_line":"        \"\"\"Send events without blocking swift proxy.\"\"\""}],"source_content_type":"text/x-python","patch_set":2,"id":"1aa78d24_ec4abeab","line":307,"in_reply_to":"3aaa91ec_636e6830","updated":"2016-07-08 15:41:55.000000000","message":"Didn\u0027t know about that - thanks!","commit_id":"266dd65a76a01d84a6bf67e5b652b189e1156557"},{"author":{"_account_id":2813,"name":"Mehdi Abaakouk","email":"sileht@sileht.net","username":"sileht"},"change_message_id":"c4b02eaaad14acd84dfeb5b0f0cdf29d981982b4","unresolved":false,"context_lines":[{"line_number":61,"context_line":"    from Queue import Queue"},{"line_number":62,"context_line":"except ImportError:"},{"line_number":63,"context_line":"    from queue import Full"},{"line_number":64,"context_line":"    from queue import Queue"},{"line_number":65,"context_line":"import six"},{"line_number":66,"context_line":"import six.moves.urllib.parse as urlparse"},{"line_number":67,"context_line":"from threading import Thread"}],"source_content_type":"text/x-python","patch_set":3,"id":"1aa78d24_b69d985b","line":64,"updated":"2016-07-08 18:36:40.000000000","message":"Can you use \u0027six.moves.XXX\u0027 instead of catching ImportError","commit_id":"8663277d477b2116f0c742608307db2f0620ac76"},{"author":{"_account_id":14768,"name":"Darren Hague","email":"d.hague@sap.com","username":"dhague"},"change_message_id":"4e2e599b642d12e0db50a21e6cabe137edd97d01","unresolved":false,"context_lines":[{"line_number":61,"context_line":"    from Queue import Queue"},{"line_number":62,"context_line":"except ImportError:"},{"line_number":63,"context_line":"    from queue import Full"},{"line_number":64,"context_line":"    from queue import Queue"},{"line_number":65,"context_line":"import six"},{"line_number":66,"context_line":"import six.moves.urllib.parse as urlparse"},{"line_number":67,"context_line":"from threading import Thread"}],"source_content_type":"text/x-python","patch_set":3,"id":"1aa78d24_a3dff30a","line":64,"in_reply_to":"1aa78d24_b69d985b","updated":"2016-07-11 08:41:27.000000000","message":"Done","commit_id":"8663277d477b2116f0c742608307db2f0620ac76"},{"author":{"_account_id":2813,"name":"Mehdi Abaakouk","email":"sileht@sileht.net","username":"sileht"},"change_message_id":"c4b02eaaad14acd84dfeb5b0f0cdf29d981982b4","unresolved":false,"context_lines":[{"line_number":116,"context_line":"    When nonblocking_notify is configured as True, a threading.Event"},{"line_number":117,"context_line":"    \u0027notified\u0027 can be passed to __init__ and will be set when the Swift"},{"line_number":118,"context_line":"    event has actually been sent to the notifier. This is primarily used by"},{"line_number":119,"context_line":"    the test suite to check the result once sent."},{"line_number":120,"context_line":"    \"\"\""},{"line_number":121,"context_line":""},{"line_number":122,"context_line":"    def __init__(self, app, conf, notified\u003dNone):"}],"source_content_type":"text/x-python","patch_set":3,"id":"1aa78d24_5681d48e","line":119,"updated":"2016-07-08 18:36:40.000000000","message":"Test suite should mock thing, and not add useless runtime code.","commit_id":"8663277d477b2116f0c742608307db2f0620ac76"},{"author":{"_account_id":14768,"name":"Darren Hague","email":"d.hague@sap.com","username":"dhague"},"change_message_id":"4e2e599b642d12e0db50a21e6cabe137edd97d01","unresolved":false,"context_lines":[{"line_number":116,"context_line":"    When nonblocking_notify is configured as True, a threading.Event"},{"line_number":117,"context_line":"    \u0027notified\u0027 can be passed to __init__ and will be set when the Swift"},{"line_number":118,"context_line":"    event has actually been sent to the notifier. This is primarily used by"},{"line_number":119,"context_line":"    the test suite to check the result once sent."},{"line_number":120,"context_line":"    \"\"\""},{"line_number":121,"context_line":""},{"line_number":122,"context_line":"    def __init__(self, app, conf, notified\u003dNone):"}],"source_content_type":"text/x-python","patch_set":3,"id":"1aa78d24_07ded26c","line":119,"in_reply_to":"1aa78d24_5681d48e","updated":"2016-07-11 08:41:27.000000000","message":"Good point - mocked notify.info to set the event instead.","commit_id":"8663277d477b2116f0c742608307db2f0620ac76"},{"author":{"_account_id":2813,"name":"Mehdi Abaakouk","email":"sileht@sileht.net","username":"sileht"},"change_message_id":"c4b02eaaad14acd84dfeb5b0f0cdf29d981982b4","unresolved":false,"context_lines":[{"line_number":153,"context_line":"        self.nonblocking_notify \u003d conf.get(\u0027nonblocking_notify\u0027, False)"},{"line_number":154,"context_line":"        if self.nonblocking_notify:"},{"line_number":155,"context_line":"            # threading.Event to set when background sending is complete"},{"line_number":156,"context_line":"            self.notified \u003d notified"},{"line_number":157,"context_line":""},{"line_number":158,"context_line":"            # Initialize the sending queue and thread, but only once"},{"line_number":159,"context_line":"            try:"}],"source_content_type":"text/x-python","patch_set":3,"id":"1aa78d24_4a4be859","line":156,"updated":"2016-07-08 18:36:40.000000000","message":"Nobody consume that event here, so no reason to keep that.","commit_id":"8663277d477b2116f0c742608307db2f0620ac76"},{"author":{"_account_id":14768,"name":"Darren Hague","email":"d.hague@sap.com","username":"dhague"},"change_message_id":"4e2e599b642d12e0db50a21e6cabe137edd97d01","unresolved":false,"context_lines":[{"line_number":153,"context_line":"        self.nonblocking_notify \u003d conf.get(\u0027nonblocking_notify\u0027, False)"},{"line_number":154,"context_line":"        if self.nonblocking_notify:"},{"line_number":155,"context_line":"            # threading.Event to set when background sending is complete"},{"line_number":156,"context_line":"            self.notified \u003d notified"},{"line_number":157,"context_line":""},{"line_number":158,"context_line":"            # Initialize the sending queue and thread, but only once"},{"line_number":159,"context_line":"            try:"}],"source_content_type":"text/x-python","patch_set":3,"id":"1aa78d24_27514ed9","line":156,"in_reply_to":"1aa78d24_4a4be859","updated":"2016-07-11 08:41:27.000000000","message":"Done","commit_id":"8663277d477b2116f0c742608307db2f0620ac76"},{"author":{"_account_id":2813,"name":"Mehdi Abaakouk","email":"sileht@sileht.net","username":"sileht"},"change_message_id":"c4b02eaaad14acd84dfeb5b0f0cdf29d981982b4","unresolved":false,"context_lines":[{"line_number":158,"context_line":"            # Initialize the sending queue and thread, but only once"},{"line_number":159,"context_line":"            try:"},{"line_number":160,"context_line":"                Swift.event_queue"},{"line_number":161,"context_line":"            except AttributeError:"},{"line_number":162,"context_line":"                send_queue_size \u003d int(conf.get(\u0027send_queue_size\u0027, 1000))"},{"line_number":163,"context_line":"                Swift.event_queue \u003d Queue(send_queue_size)"},{"line_number":164,"context_line":"                self.init_sender_thread()"}],"source_content_type":"text/x-python","patch_set":3,"id":"1aa78d24_166d8c32","line":161,"updated":"2016-07-08 18:36:40.000000000","message":"We should always set Attribute and check if they are None or set.","commit_id":"8663277d477b2116f0c742608307db2f0620ac76"},{"author":{"_account_id":14768,"name":"Darren Hague","email":"d.hague@sap.com","username":"dhague"},"change_message_id":"4e2e599b642d12e0db50a21e6cabe137edd97d01","unresolved":false,"context_lines":[{"line_number":158,"context_line":"            # Initialize the sending queue and thread, but only once"},{"line_number":159,"context_line":"            try:"},{"line_number":160,"context_line":"                Swift.event_queue"},{"line_number":161,"context_line":"            except AttributeError:"},{"line_number":162,"context_line":"                send_queue_size \u003d int(conf.get(\u0027send_queue_size\u0027, 1000))"},{"line_number":163,"context_line":"                Swift.event_queue \u003d Queue(send_queue_size)"},{"line_number":164,"context_line":"                self.init_sender_thread()"}],"source_content_type":"text/x-python","patch_set":3,"id":"1aa78d24_a7e09efb","line":161,"in_reply_to":"1aa78d24_166d8c32","updated":"2016-07-11 08:41:27.000000000","message":"Done","commit_id":"8663277d477b2116f0c742608307db2f0620ac76"},{"author":{"_account_id":2813,"name":"Mehdi Abaakouk","email":"sileht@sileht.net","username":"sileht"},"change_message_id":"c4b02eaaad14acd84dfeb5b0f0cdf29d981982b4","unresolved":false,"context_lines":[{"line_number":165,"context_line":"                _LOG.debug(\u0027Started sender thread\u0027)"},{"line_number":166,"context_line":""},{"line_number":167,"context_line":"    def init_sender_thread(self):"},{"line_number":168,"context_line":"        Swift.event_sender \u003d SendEventThread(self._notifier)"},{"line_number":169,"context_line":"        Swift.event_sender.start()"},{"line_number":170,"context_line":""},{"line_number":171,"context_line":"    def __call__(self, env, start_response):"}],"source_content_type":"text/x-python","patch_set":3,"id":"1aa78d24_761690a8","line":168,"updated":"2016-07-08 18:36:40.000000000","message":"The thread creation have to be protected by a Lock() to ensure we don\u0027t create two threads with one that shallow the other one.","commit_id":"8663277d477b2116f0c742608307db2f0620ac76"},{"author":{"_account_id":14768,"name":"Darren Hague","email":"d.hague@sap.com","username":"dhague"},"change_message_id":"4e2e599b642d12e0db50a21e6cabe137edd97d01","unresolved":false,"context_lines":[{"line_number":165,"context_line":"                _LOG.debug(\u0027Started sender thread\u0027)"},{"line_number":166,"context_line":""},{"line_number":167,"context_line":"    def init_sender_thread(self):"},{"line_number":168,"context_line":"        Swift.event_sender \u003d SendEventThread(self._notifier)"},{"line_number":169,"context_line":"        Swift.event_sender.start()"},{"line_number":170,"context_line":""},{"line_number":171,"context_line":"    def __call__(self, env, start_response):"}],"source_content_type":"text/x-python","patch_set":3,"id":"1aa78d24_0d7d511c","line":168,"in_reply_to":"1aa78d24_761690a8","updated":"2016-07-11 08:41:27.000000000","message":"Done","commit_id":"8663277d477b2116f0c742608307db2f0620ac76"},{"author":{"_account_id":2813,"name":"Mehdi Abaakouk","email":"sileht@sileht.net","username":"sileht"},"change_message_id":"c4b02eaaad14acd84dfeb5b0f0cdf29d981982b4","unresolved":false,"context_lines":[{"line_number":299,"context_line":"                return"},{"line_number":300,"context_line":""},{"line_number":301,"context_line":"            # Ensure we have a worker thread"},{"line_number":302,"context_line":"            if not Swift.event_sender.isAlive():"},{"line_number":303,"context_line":"                self.init_sender_thread()"},{"line_number":304,"context_line":"        else:"},{"line_number":305,"context_line":"            self._notifier.info({},"}],"source_content_type":"text/x-python","patch_set":3,"id":"1aa78d24_b6d598ba","line":302,"updated":"2016-07-08 18:36:40.000000000","message":"I don\u0027t get how this can occurs. \n\nI guess this is for exception raised by SendEventThread.run(). In this case run() should catch and log all exceptions instead of recreating a new thread on each exception.","commit_id":"8663277d477b2116f0c742608307db2f0620ac76"},{"author":{"_account_id":14768,"name":"Darren Hague","email":"d.hague@sap.com","username":"dhague"},"change_message_id":"4e2e599b642d12e0db50a21e6cabe137edd97d01","unresolved":false,"context_lines":[{"line_number":299,"context_line":"                return"},{"line_number":300,"context_line":""},{"line_number":301,"context_line":"            # Ensure we have a worker thread"},{"line_number":302,"context_line":"            if not Swift.event_sender.isAlive():"},{"line_number":303,"context_line":"                self.init_sender_thread()"},{"line_number":304,"context_line":"        else:"},{"line_number":305,"context_line":"            self._notifier.info({},"}],"source_content_type":"text/x-python","patch_set":3,"id":"1aa78d24_ed9e0553","line":302,"in_reply_to":"1aa78d24_b6d598ba","updated":"2016-07-11 08:41:27.000000000","message":"It\u0027s a left-over from an earlier version where the thread loop could terminate normally. Now removed.","commit_id":"8663277d477b2116f0c742608307db2f0620ac76"},{"author":{"_account_id":2813,"name":"Mehdi Abaakouk","email":"sileht@sileht.net","username":"sileht"},"change_message_id":"c0019ee5b08da56e9847fa895bd5a8ec4c009537","unresolved":false,"context_lines":[{"line_number":58,"context_line":"from pycadf import resource as cadf_resource"},{"line_number":59,"context_line":"import six"},{"line_number":60,"context_line":"from six.moves.queue import Full"},{"line_number":61,"context_line":"from six.moves.queue import Queue"},{"line_number":62,"context_line":"import six.moves.urllib.parse as urlparse"},{"line_number":63,"context_line":"from threading import Lock"},{"line_number":64,"context_line":"from threading import Thread"}],"source_content_type":"text/x-python","patch_set":5,"id":"1aa78d24_3016a2f1","line":61,"updated":"2016-07-11 08:55:59.000000000","message":"We should not import class but only module. pep8 should complain for that one.","commit_id":"b2a022f5470790e6dee2f7f9f89d5f5fbf59f5c0"},{"author":{"_account_id":2813,"name":"Mehdi Abaakouk","email":"sileht@sileht.net","username":"sileht"},"change_message_id":"c0019ee5b08da56e9847fa895bd5a8ec4c009537","unresolved":false,"context_lines":[{"line_number":147,"context_line":"        self.nonblocking_notify \u003d conf.get(\u0027nonblocking_notify\u0027, False)"},{"line_number":148,"context_line":""},{"line_number":149,"context_line":"        # Initialize the sending queue and thread, but only once"},{"line_number":150,"context_line":"        if self.nonblocking_notify:"},{"line_number":151,"context_line":"            Swift.threadLock.acquire()"},{"line_number":152,"context_line":"            if Swift.event_queue is None:"},{"line_number":153,"context_line":"                send_queue_size \u003d int(conf.get(\u0027send_queue_size\u0027, 1000))"}],"source_content_type":"text/x-python","patch_set":5,"id":"1aa78d24_90d31638","line":150,"range":{"start_line":150,"start_character":8,"end_line":150,"end_character":34},"updated":"2016-07-11 08:55:59.000000000","message":"To avoid to lock on every reques, I would change the condition by:\n\n    if self.nonblocking_notify and Swift.event_queue is not None:","commit_id":"b2a022f5470790e6dee2f7f9f89d5f5fbf59f5c0"},{"author":{"_account_id":2813,"name":"Mehdi Abaakouk","email":"sileht@sileht.net","username":"sileht"},"change_message_id":"c0019ee5b08da56e9847fa895bd5a8ec4c009537","unresolved":false,"context_lines":[{"line_number":303,"context_line":"    def run(self):"},{"line_number":304,"context_line":"        \"\"\"Send events without blocking swift proxy.\"\"\""},{"line_number":305,"context_line":"        while True:"},{"line_number":306,"context_line":"            _LOG.debug(\u0027Wait for event from send queue\u0027)"},{"line_number":307,"context_line":"            event \u003d Swift.event_queue.get()"},{"line_number":308,"context_line":"            _LOG.debug(\u0027Got event %s from queue - now send it\u0027, event.id)"},{"line_number":309,"context_line":"            Swift.send_notification(self.notifier, event)"},{"line_number":310,"context_line":"            _LOG.debug(\u0027Event %s sent.\u0027, event.id)"},{"line_number":311,"context_line":""},{"line_number":312,"context_line":""},{"line_number":313,"context_line":"def filter_factory(global_conf, **local_conf):"}],"source_content_type":"text/x-python","patch_set":5,"id":"1aa78d24_b0e0d2fb","line":310,"range":{"start_line":306,"start_character":0,"end_line":310,"end_character":50},"updated":"2016-07-11 08:55:59.000000000","message":"The block must be within a \"try/except Exception\" otherwise the thread will stop if something bad occurs.","commit_id":"b2a022f5470790e6dee2f7f9f89d5f5fbf59f5c0"},{"author":{"_account_id":2813,"name":"Mehdi Abaakouk","email":"sileht@sileht.net","username":"sileht"},"change_message_id":"c725471a6df1c6616daebe0b42401a41c0ef11c9","unresolved":false,"context_lines":[{"line_number":308,"context_line":"                Swift.send_notification(self.notifier, event)"},{"line_number":309,"context_line":"                _LOG.debug(\u0027Event %s sent.\u0027, event.id)"},{"line_number":310,"context_line":"            except Exception as e:"},{"line_number":311,"context_line":"                _LOG.warning(\"SendEventThread loop exception: %s\", e.message)"},{"line_number":312,"context_line":""},{"line_number":313,"context_line":""},{"line_number":314,"context_line":"def filter_factory(global_conf, **local_conf):"}],"source_content_type":"text/x-python","patch_set":6,"id":"1aa78d24_3cc0392a","line":311,"updated":"2016-07-11 10:04:43.000000000","message":"We should use _LOG.exception()","commit_id":"93c081bc16c2cd6a57ea99ce90bae12f58727ce5"},{"author":{"_account_id":14768,"name":"Darren Hague","email":"d.hague@sap.com","username":"dhague"},"change_message_id":"ee85bf5eda0347b5260984254dcc580b5672bf69","unresolved":false,"context_lines":[{"line_number":308,"context_line":"                Swift.send_notification(self.notifier, event)"},{"line_number":309,"context_line":"                _LOG.debug(\u0027Event %s sent.\u0027, event.id)"},{"line_number":310,"context_line":"            except Exception as e:"},{"line_number":311,"context_line":"                _LOG.warning(\"SendEventThread loop exception: %s\", e.message)"},{"line_number":312,"context_line":""},{"line_number":313,"context_line":""},{"line_number":314,"context_line":"def filter_factory(global_conf, **local_conf):"}],"source_content_type":"text/x-python","patch_set":6,"id":"1aa78d24_104561b2","line":311,"in_reply_to":"1aa78d24_3cc0392a","updated":"2016-07-11 10:24:04.000000000","message":"Done","commit_id":"93c081bc16c2cd6a57ea99ce90bae12f58727ce5"}]}
