)]}'
{"oslo_cache/_memcache_pool.py":[{"author":{"_account_id":7109,"name":"Dmitry Mescheryakov (dmitryme)","email":"dmescheryakov@mirantis.com","username":"dmitryme"},"change_message_id":"26ccfabe5a792ef9194ca52672242cb8b808908c","unresolved":false,"context_lines":[{"line_number":170,"context_line":"    def _drop_expired_connections(self):"},{"line_number":171,"context_line":"        \"\"\"Drop all expired connections from the right end of the queue.\"\"\""},{"line_number":172,"context_line":"        now \u003d time.time()"},{"line_number":173,"context_line":"        while len(self.queue) and self.queue[0].ttl \u003c now:"},{"line_number":174,"context_line":"            conn \u003d self.queue.popleft().connection"},{"line_number":175,"context_line":"            self._trace_logger(\u0027Reaping connection %s\u0027, id(conn))"},{"line_number":176,"context_line":"            self._destroy_connection(conn)"}],"source_content_type":"text/x-python","patch_set":1,"id":"9abb7d3a_4818f175","line":173,"updated":"2016-06-03 12:27:30.000000000","message":"Hmm, do you mean that self.queue and len(self.queue) are not equivalent here? Here self.queue is a deque:\nhttps://github.com/python/cpython/blob/master/Lib/queue.py#L200\n\nMy experiments show that bool(deque) evaluates to True if it is filled and to False if it is empty.","commit_id":"389d332d51897264c3ba464b45e7eec17ab15ce9"},{"author":{"_account_id":13055,"name":"Alexander Makarov","email":"ajiekcahdp.makapob@gmail.com","username":"amakarov"},"change_message_id":"057e8910337ed6f69db4ce266f2b400245a3119f","unresolved":false,"context_lines":[{"line_number":170,"context_line":"    def _drop_expired_connections(self):"},{"line_number":171,"context_line":"        \"\"\"Drop all expired connections from the right end of the queue.\"\"\""},{"line_number":172,"context_line":"        now \u003d time.time()"},{"line_number":173,"context_line":"        while len(self.queue) and self.queue[0].ttl \u003c now:"},{"line_number":174,"context_line":"            conn \u003d self.queue.popleft().connection"},{"line_number":175,"context_line":"            self._trace_logger(\u0027Reaping connection %s\u0027, id(conn))"},{"line_number":176,"context_line":"            self._destroy_connection(conn)"}],"source_content_type":"text/x-python","patch_set":1,"id":"9abb7d3a_689fb55f","line":173,"in_reply_to":"9abb7d3a_4818f175","updated":"2016-06-03 12:31:44.000000000","message":"Done","commit_id":"389d332d51897264c3ba464b45e7eec17ab15ce9"},{"author":{"_account_id":7109,"name":"Dmitry Mescheryakov (dmitryme)","email":"dmescheryakov@mirantis.com","username":"dmitryme"},"change_message_id":"2b3819d3cf95c2993b6c1382329c0109f78b649e","unresolved":false,"context_lines":[{"line_number":161,"context_line":""},{"line_number":162,"context_line":"    def _get(self):"},{"line_number":163,"context_line":"        if self.queue:"},{"line_number":164,"context_line":"            conn \u003d self.queue.pop().connection"},{"line_number":165,"context_line":"        else:"},{"line_number":166,"context_line":"            conn \u003d self._create_connection()"},{"line_number":167,"context_line":"        self._acquired +\u003d 1"}],"source_content_type":"text/x-python","patch_set":2,"id":"9abb7d3a_58af1ae3","line":164,"updated":"2016-06-03 13:39:48.000000000","message":"What if \u0027get\u0027 is called concurrently? In that case there is probability that between \u0027if self.queue\u0027 check and \u0027conn \u003d self.queue.pop().connection\u0027 some thread steals our connection and we get IndexError here as well.\n\nThat is possible only on native threads without eventlet, but I assume that we target such case as well.","commit_id":"9b39439037ecd8cfe2d21ee50c8516eedfb64b89"},{"author":{"_account_id":8688,"name":"Alexis Lee","email":"openstack@lxsli.co.uk","username":"lxsli"},"change_message_id":"00aa0ac76066b431a9c1da68eba099cfe2bffbaf","unresolved":false,"context_lines":[{"line_number":175,"context_line":"                conn \u003d self.queue.popleft().connection"},{"line_number":176,"context_line":"                self._trace_logger(\u0027Reaping connection %s\u0027, id(conn))"},{"line_number":177,"context_line":"                self._destroy_connection(conn)"},{"line_number":178,"context_line":"        except IndexError:"},{"line_number":179,"context_line":"            # This is an expected excepton. so there\u0027s no need to react"},{"line_number":180,"context_line":"            pass"},{"line_number":181,"context_line":""}],"source_content_type":"text/x-python","patch_set":3,"id":"5a9d85d2_83862e63","line":178,"updated":"2016-06-21 15:20:30.000000000","message":"I\u0027d prefer we check len(self.queue); try/except blocks may be cheap but raising an exception is quite expensive and not something we should do simply to iterate","commit_id":"a78300f317dfdb0d6f7ddc501f0832e90fc7ee89"},{"author":{"_account_id":13055,"name":"Alexander Makarov","email":"ajiekcahdp.makapob@gmail.com","username":"amakarov"},"change_message_id":"fe3f456afff9406fec42c20a2bacfc68c1f09a61","unresolved":false,"context_lines":[{"line_number":175,"context_line":"                conn \u003d self.queue.popleft().connection"},{"line_number":176,"context_line":"                self._trace_logger(\u0027Reaping connection %s\u0027, id(conn))"},{"line_number":177,"context_line":"                self._destroy_connection(conn)"},{"line_number":178,"context_line":"        except IndexError:"},{"line_number":179,"context_line":"            # This is an expected excepton. so there\u0027s no need to react"},{"line_number":180,"context_line":"            pass"},{"line_number":181,"context_line":""}],"source_content_type":"text/x-python","patch_set":3,"id":"5a9d85d2_83baaebe","line":178,"in_reply_to":"5a9d85d2_83862e63","updated":"2016-06-21 15:26:16.000000000","message":"Done","commit_id":"a78300f317dfdb0d6f7ddc501f0832e90fc7ee89"},{"author":{"_account_id":13055,"name":"Alexander Makarov","email":"ajiekcahdp.makapob@gmail.com","username":"amakarov"},"change_message_id":"8779d3ae691b3f5c93ec92954d70cf3fd1ae45fd","unresolved":false,"context_lines":[{"line_number":175,"context_line":"                conn \u003d self.queue.popleft().connection"},{"line_number":176,"context_line":"                self._trace_logger(\u0027Reaping connection %s\u0027, id(conn))"},{"line_number":177,"context_line":"                self._destroy_connection(conn)"},{"line_number":178,"context_line":"        except IndexError:"},{"line_number":179,"context_line":"            # This is an expected excepton. so there\u0027s no need to react"},{"line_number":180,"context_line":"            pass"},{"line_number":181,"context_line":""}],"source_content_type":"text/x-python","patch_set":3,"id":"5a9d85d2_dede4d3e","line":178,"in_reply_to":"5a9d85d2_83baaebe","updated":"2016-06-21 15:37:45.000000000","message":"Oops, we can\u0027t do that: IndexError can occur on race condition.","commit_id":"a78300f317dfdb0d6f7ddc501f0832e90fc7ee89"},{"author":{"_account_id":6482,"name":"Steve Martinelli","email":"s.martinelli@gmail.com","username":"stevemar"},"change_message_id":"c7e463e874f5061b1257e6ce0617daa11ce77f7f","unresolved":false,"context_lines":[{"line_number":179,"context_line":"            # NOTE(amakarov): This is an expected excepton. so there\u0027s no"},{"line_number":180,"context_line":"            # need to react. We have to handle exceptions instead of"},{"line_number":181,"context_line":"            # checking queue length as IndexError is a result of race"},{"line_number":182,"context_line":"            # condition too as well as of mere queue depletio of mere queue"},{"line_number":183,"context_line":"            # depletionn."},{"line_number":184,"context_line":"            pass"},{"line_number":185,"context_line":""},{"line_number":186,"context_line":"    def _put(self, conn):"}],"source_content_type":"text/x-python","patch_set":5,"id":"3aaa91ec_fefeff03","line":183,"range":{"start_line":182,"start_character":42,"end_line":183,"end_character":24},"updated":"2016-06-21 20:34:17.000000000","message":"the same words twice, should be \"as well as queue depletion.\"","commit_id":"79ebe621f882aa6a793f13351d73bb13f5a312de"}]}
