)]}'
{"zaqar/notification/notifier.py":[{"author":{"_account_id":6484,"name":"Feilong Wang","email":"hustemb@gmail.com","username":"flwang"},"change_message_id":"c1b1955657757551cef78e591ba65066b76a15da","unresolved":false,"context_lines":[{"line_number":51,"context_line":"                                           invoke_on_load\u003dTrue)"},{"line_number":52,"context_line":"                # Let\u0027s not modify the original list of messages, though it"},{"line_number":53,"context_line":"                # still would be safe."},{"line_number":54,"context_line":"                notifications \u003d copy.deepcopy(messages)"},{"line_number":55,"context_line":"                for notification in notifications:"},{"line_number":56,"context_line":"                    notification[\u0027queue_name\u0027] \u003d queue_name"},{"line_number":57,"context_line":"                self.executor.submit(mgr.driver.execute, sub, notifications,"}],"source_content_type":"text/x-python","patch_set":5,"id":"5a5ae5dd_4c71180b","line":54,"updated":"2016-02-08 21:59:06.000000000","message":"IMHO, at this stage, the deepcopy is happening in the same thread of zaqar server, the message posting pipeline. That\u0027s said, it may impact the performance a bit. So i\u0027m thinking if it\u0027s better to add the queue name at the \u0027sub-thread\u0027 level.","commit_id":"0238f62d610a47a20b271907f20ae1b8bc50a28d"},{"author":{"_account_id":18683,"name":"Eva Balycheva","email":"ubershy@gmail.com","username":"eva"},"change_message_id":"961274710e7be2b8294ea5d6d8a99907a1c1492b","unresolved":false,"context_lines":[{"line_number":51,"context_line":"                                           invoke_on_load\u003dTrue)"},{"line_number":52,"context_line":"                # Let\u0027s not modify the original list of messages, though it"},{"line_number":53,"context_line":"                # still would be safe."},{"line_number":54,"context_line":"                notifications \u003d copy.deepcopy(messages)"},{"line_number":55,"context_line":"                for notification in notifications:"},{"line_number":56,"context_line":"                    notification[\u0027queue_name\u0027] \u003d queue_name"},{"line_number":57,"context_line":"                self.executor.submit(mgr.driver.execute, sub, notifications,"}],"source_content_type":"text/x-python","patch_set":5,"id":"5a5ae5dd_9385dfae","line":54,"in_reply_to":"5a5ae5dd_4c71180b","updated":"2016-02-09 05:45:56.000000000","message":"I think I made a mistake putting \"notifications \u003d copy.deepcopy(messages)\" code inside this cycle. It should be outside, so Zaqar will not make the same work more than once.\nI uploaded a new patch set which makes it right.\nBut yes, it\u0027s sad that the work will be done in the main Zaqar thread.\n\nIn case we add the queue name in \u0027sub-treads\u0027, the work will be done in \u0027sub-threads\u0027, but multiple times (how many subscribers queue has) and the code will be duplicated.","commit_id":"0238f62d610a47a20b271907f20ae1b8bc50a28d"},{"author":{"_account_id":6484,"name":"Feilong Wang","email":"hustemb@gmail.com","username":"flwang"},"change_message_id":"de934de94dfb786fae4bb2694d36ec2338ad63de","unresolved":false,"context_lines":[{"line_number":35,"context_line":"        # TODO(flwang): Make the max_workers configurable"},{"line_number":36,"context_line":"        self.executor \u003d futurist.ThreadPoolExecutor(max_workers\u003d10)"},{"line_number":37,"context_line":""},{"line_number":38,"context_line":"    def post(self, queue_name, messages, client_uuid, project\u003dNone):"},{"line_number":39,"context_line":"        \"\"\"Send notifications to the subscribers.\"\"\""},{"line_number":40,"context_line":"        if (self.subscription_controller and"},{"line_number":41,"context_line":"            not isinstance(self.subscription_controller,"}],"source_content_type":"text/x-python","patch_set":8,"id":"3a57f1b5_0a4a0d84","line":38,"updated":"2016-02-10 00:33:19.000000000","message":"We don\u0027t need the change at this level. Since at the task driver level, we can easily get the queue name from subscription info, see https://github.com/openstack/zaqar/blob/master/zaqar/notification/task/mailto.py#L30","commit_id":"17b33b4e1b915f6a0c0a3c7c3eca485a712bd6d5"},{"author":{"_account_id":18683,"name":"Eva Balycheva","email":"ubershy@gmail.com","username":"eva"},"change_message_id":"787581295f9013941923d53f875ab1fe3d51b3ea","unresolved":false,"context_lines":[{"line_number":35,"context_line":"        # TODO(flwang): Make the max_workers configurable"},{"line_number":36,"context_line":"        self.executor \u003d futurist.ThreadPoolExecutor(max_workers\u003d10)"},{"line_number":37,"context_line":""},{"line_number":38,"context_line":"    def post(self, queue_name, messages, client_uuid, project\u003dNone):"},{"line_number":39,"context_line":"        \"\"\"Send notifications to the subscribers.\"\"\""},{"line_number":40,"context_line":"        if (self.subscription_controller and"},{"line_number":41,"context_line":"            not isinstance(self.subscription_controller,"}],"source_content_type":"text/x-python","patch_set":8,"id":"3a57f1b5_e5a9e2e0","line":38,"in_reply_to":"3a57f1b5_0a4a0d84","updated":"2016-02-10 00:48:47.000000000","message":"The advantage of changing messages at this level is that we need to perform this work only once. Disadvantage is some performance loss on Zaqar main thread. But if you want, we will not do deepcopy and there will be almost no performance loss.\n\nIn case we change the messages at worker levels (malto and webhook), we will do the same work as many times as there are subscribers, i.e. 100 subscribers \u003d 100x additional work.\n\nI think the first approach is better. If after my words you still think the second approach is better, I can easily implement it, no worries. ;)\n\nWhat do you think now?","commit_id":"17b33b4e1b915f6a0c0a3c7c3eca485a712bd6d5"}],"zaqar/notification/task/webhook.py":[{"author":{"_account_id":18683,"name":"Eva Balycheva","email":"ubershy@gmail.com","username":"eva"},"change_message_id":"810b1ba069a585c7b7476e892c0844170b93f4db","unresolved":false,"context_lines":[{"line_number":22,"context_line":""},{"line_number":23,"context_line":"class WebhookTask(object):"},{"line_number":24,"context_line":""},{"line_number":25,"context_line":"    def execute(self, subscription, notifications, **kwargs):"},{"line_number":26,"context_line":"        try:"},{"line_number":27,"context_line":"            for notification in notifications:"},{"line_number":28,"context_line":"                requests.post(subscription[\u0027subscriber\u0027],"}],"source_content_type":"text/x-python","patch_set":3,"id":"5a5ae5dd_8d4757bb","line":25,"range":{"start_line":25,"start_character":36,"end_line":25,"end_character":49},"updated":"2016-02-05 23:58:32.000000000","message":"Decided to rename \"messages\" to \"notifications\", because the elements of this list are no longer pure messages: they contain additional \"queue_name\" key.","commit_id":"6d99f04a095d9bb7d5eb14605ef29fb93057b781"},{"author":{"_account_id":18683,"name":"Eva Balycheva","email":"ubershy@gmail.com","username":"eva"},"change_message_id":"810b1ba069a585c7b7476e892c0844170b93f4db","unresolved":false,"context_lines":[{"line_number":24,"context_line":""},{"line_number":25,"context_line":"    def execute(self, subscription, notifications, **kwargs):"},{"line_number":26,"context_line":"        try:"},{"line_number":27,"context_line":"            for notification in notifications:"},{"line_number":28,"context_line":"                requests.post(subscription[\u0027subscriber\u0027],"},{"line_number":29,"context_line":"                              data\u003djson.dumps(notification),"},{"line_number":30,"context_line":"                              headers\u003d{\u0027Content-Type\u0027: \u0027application/json\u0027})"}],"source_content_type":"text/x-python","patch_set":3,"id":"5a5ae5dd_4d62bf3f","line":27,"updated":"2016-02-05 23:58:32.000000000","message":"Not much related to my patch: I wonder why we send notification for each message in the list? Maybe, if we send the whole list of messages in each notification, we can optimize network and CPU loads?\n\nAlso it doesn\u0027t feel 100% right to modify the contents of each message in \"notifier.py\" just to add the queue name as I did.\n\nMaybe we still can change the API and warn about this other OpenStack projects that are currently trying to integrate our subscriptions. I don\u0027t think there\u0027s much probability of someone else is using our subscriptions, since our TTL issue was unnoticed for a long time.\n\nIf we change the API, we could make notifications (with this patch applied) look like this, for example:\n\n{\u0027queue_name\u0027: \u0027myqueue\u0027, \u0027messages\u0027: [{\u0027body\u0027: \u0027message1\u0027, \u0027ttl\u0027: 60}, {\u0027body\u0027: \u0027message2\u0027, \u0027ttl\u0027: 60}]}","commit_id":"6d99f04a095d9bb7d5eb14605ef29fb93057b781"}]}
