)]}'
{"/COMMIT_MSG":[{"author":{"_account_id":12321,"name":"Ryan Brown","email":"rybrown@redhat.com","username":"ryansb"},"change_message_id":"51dd231eb587d02dbd217a358b9b4ed42716c204","unresolved":false,"context_lines":[{"line_number":8,"context_line":""},{"line_number":9,"context_line":"Currently, the TTL of subscriptons doesn\u0027t work. This pathc fixes it"},{"line_number":10,"context_line":"and now if user don\u0027t pass in a TTL value, the default value will"},{"line_number":11,"context_line":"be None and as a result the subscription will be a permanent"},{"line_number":12,"context_line":"subscription."},{"line_number":13,"context_line":""},{"line_number":14,"context_line":"A functional test will be added in Zaqar client."}],"source_content_type":"text/x-gerrit-commit-message","patch_set":2,"id":"9a68dd71_0b9c0168","line":11,"updated":"2016-01-21 21:08:56.000000000","message":"Are you saying that default-eternal subscriptions are the result of this patch, or that\u0027s what this patch is fixing?","commit_id":"99d95d98a354a3fb84b09ec124b6299349106851"},{"author":{"_account_id":18683,"name":"Eva Balycheva","email":"ubershy@gmail.com","username":"eva"},"change_message_id":"6463954cbb860b9abb61490ffdefb829bb4532e5","unresolved":false,"context_lines":[{"line_number":7,"context_line":"Fix the TTL issue of subscriptions for MongoDB"},{"line_number":8,"context_line":""},{"line_number":9,"context_line":"Currently, the TTL of subscriptons doesn\u0027t work. That said, after"},{"line_number":10,"context_line":"the ttl seconds, the subscription can\u0027t be deleted. This pathch"},{"line_number":11,"context_line":"fixes it and a functional test will be added in Zaqar client."},{"line_number":12,"context_line":""},{"line_number":13,"context_line":"Partial-Bug: #1529168"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":8,"id":"bae84128_c45ea311","line":10,"range":{"start_line":10,"start_character":57,"end_line":10,"end_character":63},"updated":"2016-02-21 13:47:56.000000000","message":"Little typo.","commit_id":"7f4a9a92281ed02c118c0d1d327d65e3e3420ece"}],"zaqar/storage/mongodb/subscriptions.py":[{"author":{"_account_id":12321,"name":"Ryan Brown","email":"rybrown@redhat.com","username":"ryansb"},"change_message_id":"c7699d44229b22c798278df3029a74ab2bcf446e","unresolved":false,"context_lines":[{"line_number":56,"context_line":"        self._queue_ctrl \u003d self.driver.queue_controller"},{"line_number":57,"context_line":"        self._collection.ensure_index(SUBSCRIPTIONS_INDEX, unique\u003dTrue)"},{"line_number":58,"context_line":"        self._collection.ensure_index(TTL_INDEX_FIELDS, name\u003d\u0027ttl\u0027,"},{"line_number":59,"context_line":"                                      expireAfterSeconds\u003d0,"},{"line_number":60,"context_line":"                                      background\u003dTrue)"},{"line_number":61,"context_line":""},{"line_number":62,"context_line":"    @utils.raises_conn_error"}],"source_content_type":"text/x-python","patch_set":2,"id":"9a68dd71_bdcfae54","line":59,"range":{"start_line":59,"start_character":38,"end_line":59,"end_character":56},"updated":"2016-01-25 18:19:26.000000000","message":"I\u0027m pretty sure having an immediately-expiring index isn\u0027t going to improve performance. There should at least be a 60 second TTL on the index. If notifications still get sent for a minute, that shouldn\u0027t be a problem and it will reduce the load on the DB servers.","commit_id":"99d95d98a354a3fb84b09ec124b6299349106851"},{"author":{"_account_id":12321,"name":"Ryan Brown","email":"rybrown@redhat.com","username":"ryansb"},"change_message_id":"c7699d44229b22c798278df3029a74ab2bcf446e","unresolved":false,"context_lines":[{"line_number":101,"context_line":"    def create(self, queue, subscriber, ttl, options, project\u003dNone):"},{"line_number":102,"context_line":"        source \u003d queue"},{"line_number":103,"context_line":"        now \u003d timeutils.utcnow_ts()"},{"line_number":104,"context_line":"        # NOTE(flwang): If TTL is None then we will take it as a permanent"},{"line_number":105,"context_line":"        # subscription. That said the subscription won\u0027t be removed"},{"line_number":106,"context_line":"        # automatically unless user delete it manually."},{"line_number":107,"context_line":"        now_dt \u003d datetime.datetime.utcfromtimestamp(now)"}],"source_content_type":"text/x-python","patch_set":2,"id":"9a68dd71_9dfbca78","line":104,"range":{"start_line":104,"start_character":10,"end_line":104,"end_character":74},"updated":"2016-01-25 18:19:26.000000000","message":"I\u0027m still against forever-by-default. Keystone has this problem with tokens, where tokens will persist forever and fill up the DB even though they\u0027re unused. We should have a default expiration that is long-but-not-forever, say a week.","commit_id":"99d95d98a354a3fb84b09ec124b6299349106851"},{"author":{"_account_id":18683,"name":"Eva Balycheva","email":"ubershy@gmail.com","username":"eva"},"change_message_id":"a46848a2e17fa0c2cf25e5fa5962f9d0b8bb7c18","unresolved":false,"context_lines":[{"line_number":105,"context_line":"        # subscription. That said the subscription won\u0027t be removed"},{"line_number":106,"context_line":"        # automatically unless user delete it manually."},{"line_number":107,"context_line":"        now_dt \u003d datetime.datetime.utcfromtimestamp(now)"},{"line_number":108,"context_line":"        if ttl and isinstance(ttl, int):"},{"line_number":109,"context_line":"            ttl \u003d int(ttl)"},{"line_number":110,"context_line":"            expires \u003d now_dt + datetime.timedelta(seconds\u003dint(ttl))"},{"line_number":111,"context_line":"        else:"}],"source_content_type":"text/x-python","patch_set":2,"id":"9a68dd71_40ed2b8a","line":108,"range":{"start_line":108,"start_character":19,"end_line":108,"end_character":39},"updated":"2016-01-21 03:34:45.000000000","message":"No need for this part of condition. The transport layer guarantees that the data that coming to storage layer is good.","commit_id":"99d95d98a354a3fb84b09ec124b6299349106851"},{"author":{"_account_id":18683,"name":"Eva Balycheva","email":"ubershy@gmail.com","username":"eva"},"change_message_id":"a46848a2e17fa0c2cf25e5fa5962f9d0b8bb7c18","unresolved":false,"context_lines":[{"line_number":106,"context_line":"        # automatically unless user delete it manually."},{"line_number":107,"context_line":"        now_dt \u003d datetime.datetime.utcfromtimestamp(now)"},{"line_number":108,"context_line":"        if ttl and isinstance(ttl, int):"},{"line_number":109,"context_line":"            ttl \u003d int(ttl)"},{"line_number":110,"context_line":"            expires \u003d now_dt + datetime.timedelta(seconds\u003dint(ttl))"},{"line_number":111,"context_line":"        else:"},{"line_number":112,"context_line":"            expires \u003d None"}],"source_content_type":"text/x-python","patch_set":2,"id":"9a68dd71_bb1a166d","line":109,"range":{"start_line":109,"start_character":18,"end_line":109,"end_character":22},"updated":"2016-01-21 03:34:45.000000000","message":"Again, the transport layer guarantees TTL is an int.\n\nUsing additional casts and checks in the storage layer makes the code more complex and can hide existing problems in the transport layer. And if there are problems in the transport layer, they may become visible only on switch to another storage layer.\n\nLet it crash or corrupt the database, if the data provided by the storage layer is bad. It will allow us to find the hidden bugs.","commit_id":"99d95d98a354a3fb84b09ec124b6299349106851"},{"author":{"_account_id":18683,"name":"Eva Balycheva","email":"ubershy@gmail.com","username":"eva"},"change_message_id":"2a51dede9dbe018d9d58b03a5f626de83b51146f","unresolved":false,"context_lines":[{"line_number":106,"context_line":"        # automatically unless user delete it manually."},{"line_number":107,"context_line":"        now_dt \u003d datetime.datetime.utcfromtimestamp(now)"},{"line_number":108,"context_line":"        if ttl and isinstance(ttl, int):"},{"line_number":109,"context_line":"            ttl \u003d int(ttl)"},{"line_number":110,"context_line":"            expires \u003d now_dt + datetime.timedelta(seconds\u003dint(ttl))"},{"line_number":111,"context_line":"        else:"},{"line_number":112,"context_line":"            expires \u003d None"}],"source_content_type":"text/x-python","patch_set":2,"id":"9a68dd71_6d24a8ae","line":109,"range":{"start_line":109,"start_character":18,"end_line":109,"end_character":22},"in_reply_to":"9a68dd71_bb1a166d","updated":"2016-01-22 01:25:54.000000000","message":"s/data provided by the storage layer/data provided by the transport layer","commit_id":"99d95d98a354a3fb84b09ec124b6299349106851"},{"author":{"_account_id":18683,"name":"Eva Balycheva","email":"ubershy@gmail.com","username":"eva"},"change_message_id":"a46848a2e17fa0c2cf25e5fa5962f9d0b8bb7c18","unresolved":false,"context_lines":[{"line_number":107,"context_line":"        now_dt \u003d datetime.datetime.utcfromtimestamp(now)"},{"line_number":108,"context_line":"        if ttl and isinstance(ttl, int):"},{"line_number":109,"context_line":"            ttl \u003d int(ttl)"},{"line_number":110,"context_line":"            expires \u003d now_dt + datetime.timedelta(seconds\u003dint(ttl))"},{"line_number":111,"context_line":"        else:"},{"line_number":112,"context_line":"            expires \u003d None"},{"line_number":113,"context_line":""}],"source_content_type":"text/x-python","patch_set":2,"id":"9a68dd71_7b2b3e83","line":110,"range":{"start_line":110,"start_character":58,"end_line":110,"end_character":61},"updated":"2016-01-21 03:34:45.000000000","message":"Same here","commit_id":"99d95d98a354a3fb84b09ec124b6299349106851"},{"author":{"_account_id":12321,"name":"Ryan Brown","email":"rybrown@redhat.com","username":"ryansb"},"change_message_id":"6c9928ed8f9b0c7d4ee1200ac22c3fc8f3fb0c4d","unresolved":false,"context_lines":[{"line_number":57,"context_line":"        self._collection.ensure_index(SUBSCRIPTIONS_INDEX, unique\u003dTrue)"},{"line_number":58,"context_line":"        self._collection.ensure_index(TTL_INDEX_FIELDS, name\u003d\u0027ttl\u0027,"},{"line_number":59,"context_line":"                                      expireAfterSeconds\u003d0,"},{"line_number":60,"context_line":"                                      background\u003dTrue)"},{"line_number":61,"context_line":""},{"line_number":62,"context_line":"    @utils.raises_conn_error"},{"line_number":63,"context_line":"    def list(self, queue, project\u003dNone, marker\u003dNone,"}],"source_content_type":"text/x-python","patch_set":3,"id":"7a5de9d1_3f3d42c4","line":60,"updated":"2016-01-29 20:44:00.000000000","message":"I think this call warrants a link to https://docs.mongodb.org/manual/tutorial/expire-data/#expire-documents-at-a-specific-clock-time because it\u0027s non-obvious what \"expiring after 0 seconds\" even means, since that could mean \"never expire\" or \"die immediately\" or something else.","commit_id":"c3c9d82bf9d8461d175f67b812cf6f9a2fa60a22"},{"author":{"_account_id":6484,"name":"Feilong Wang","email":"hustemb@gmail.com","username":"flwang"},"change_message_id":"44ad92eba3232edd7d06fcd41a26a7c482bc4149","unresolved":false,"context_lines":[{"line_number":57,"context_line":"        self._collection.ensure_index(SUBSCRIPTIONS_INDEX, unique\u003dTrue)"},{"line_number":58,"context_line":"        self._collection.ensure_index(TTL_INDEX_FIELDS, name\u003d\u0027ttl\u0027,"},{"line_number":59,"context_line":"                                      expireAfterSeconds\u003d0,"},{"line_number":60,"context_line":"                                      background\u003dTrue)"},{"line_number":61,"context_line":""},{"line_number":62,"context_line":"    @utils.raises_conn_error"},{"line_number":63,"context_line":"    def list(self, queue, project\u003dNone, marker\u003dNone,"}],"source_content_type":"text/x-python","patch_set":3,"id":"7a5de9d1_9fc2dd83","line":60,"in_reply_to":"7a5de9d1_3f3d42c4","updated":"2016-02-02 02:58:49.000000000","message":"Yes, thanks for the link.","commit_id":"c3c9d82bf9d8461d175f67b812cf6f9a2fa60a22"},{"author":{"_account_id":12321,"name":"Ryan Brown","email":"rybrown@redhat.com","username":"ryansb"},"change_message_id":"fe23fa7cd054a4ce3cdaf6d0988f0f89d36ac37f","unresolved":false,"context_lines":[{"line_number":55,"context_line":"        self._collection \u003d self.driver.subscriptions_database.subscriptions"},{"line_number":56,"context_line":"        self._queue_ctrl \u003d self.driver.queue_controller"},{"line_number":57,"context_line":"        self._collection.ensure_index(SUBSCRIPTIONS_INDEX, unique\u003dTrue)"},{"line_number":58,"context_line":"        self._collection.ensure_index(TTL_INDEX_FIELDS, name\u003d\u0027ttl\u0027,"},{"line_number":59,"context_line":"                                      expireAfterSeconds\u003d0,"},{"line_number":60,"context_line":"                                      background\u003dTrue)"},{"line_number":61,"context_line":""}],"source_content_type":"text/x-python","patch_set":6,"id":"dae33548_ca57e000","line":58,"updated":"2016-02-15 20:44:32.000000000","message":"I\u0027d still appreciate a comment here on what the expireAfterSeconds parameter here does, and why it\u0027s needed for this index.","commit_id":"f513bbffc2c78cd079effa20cf35694b37f0c2af"},{"author":{"_account_id":18683,"name":"Eva Balycheva","email":"ubershy@gmail.com","username":"eva"},"change_message_id":"e58a6c4c65ef10d1f1c39c19ff2de3f083e716f5","unresolved":false,"context_lines":[{"line_number":56,"context_line":"        self._queue_ctrl \u003d self.driver.queue_controller"},{"line_number":57,"context_line":"        self._collection.ensure_index(SUBSCRIPTIONS_INDEX, unique\u003dTrue)"},{"line_number":58,"context_line":"        # NOTE(flwang): MongoDB will automatically delete the subscription"},{"line_number":59,"context_line":"        # from the subscriptions collection when the subscription’s \u0027e\u0027 value"},{"line_number":60,"context_line":"        # is older than the number of seconds specified in expireAfterSeconds,"},{"line_number":61,"context_line":"        # i.e. 0 seconds older in this case. As such, the data expires at the"},{"line_number":62,"context_line":"        # specified \u0027e\u0027 value."}],"source_content_type":"text/x-python","patch_set":7,"id":"dae33548_f99adb12","line":59,"range":{"start_line":59,"start_character":65,"end_line":59,"end_character":66},"updated":"2016-02-18 14:20:24.000000000","message":"This is non-ASCII symbol, please replace it to \u0027.\nThis will fix this error: \"ImportError: cannot import name catalogue\".","commit_id":"c3fef574026be747279760409cb0dcf9f1d7555b"},{"author":{"_account_id":18683,"name":"Eva Balycheva","email":"ubershy@gmail.com","username":"eva"},"change_message_id":"35b6b2a56c94fac7d115b0ccc91411e0794ac670","unresolved":false,"context_lines":[{"line_number":106,"context_line":"    def create(self, queue, subscriber, ttl, options, project\u003dNone):"},{"line_number":107,"context_line":"        source \u003d queue"},{"line_number":108,"context_line":"        now \u003d timeutils.utcnow_ts()"},{"line_number":109,"context_line":"        # NOTE(flwang): If TTL is None then we will take it as a permanent"},{"line_number":110,"context_line":"        # subscription. That said the subscription won\u0027t be removed"},{"line_number":111,"context_line":"        # automatically unless user delete it manually."},{"line_number":112,"context_line":"        now_dt \u003d datetime.datetime.utcfromtimestamp(now)"},{"line_number":113,"context_line":"        expires \u003d now_dt + datetime.timedelta(seconds\u003dttl)"}],"source_content_type":"text/x-python","patch_set":9,"id":"bae84128_7d754cf8","line":110,"range":{"start_line":109,"start_character":24,"end_line":110,"end_character":22},"updated":"2016-02-23 15:15:17.000000000","message":"Here are permanent subscriptions are mentioned.","commit_id":"21d09fa8f46d7a44deb95a94ad8264fcdbb41bd6"},{"author":{"_account_id":18683,"name":"Eva Balycheva","email":"ubershy@gmail.com","username":"eva"},"change_message_id":"71faddd5c60347cb2c0a936afa912bec343b96a2","unresolved":false,"context_lines":[{"line_number":107,"context_line":"        source \u003d queue"},{"line_number":108,"context_line":"        now \u003d timeutils.utcnow_ts()"},{"line_number":109,"context_line":"        now_dt \u003d datetime.datetime.utcfromtimestamp(now)"},{"line_number":110,"context_line":"        expires \u003d now_dt + datetime.timedelta(seconds\u003dttl)"},{"line_number":111,"context_line":""},{"line_number":112,"context_line":"        if not self._queue_ctrl.exists(source, project):"},{"line_number":113,"context_line":"            raise errors.QueueDoesNotExist(source, project)"}],"source_content_type":"text/x-python","patch_set":10,"id":"7af24918_204c349d","line":110,"updated":"2016-03-03 14:19:19.000000000","message":"I sense there a potential compatibility problem.\nImagine there\u0027s a cloud admin and he\u0027s already have subscriptions in mongodb database, so \"expires\" field in these subscriptions is in INT format.\nAfter this patch, new subscriptions in mongodb will have \"expires\" field in DATETIME format.\nNothing bad will happen, because we don\u0027t use this field in Zaqar when getting subscription. See our normalizers at L80 and L154.\n\nBut soon we will implement \"age\" and expose it in responses. To calculate this field we will need to use \"expires\" field. With old Zaqar databases \"expires\" will be INT or DATETIME. I hope it will be possible to calculate \"age\" field in both cases, right? We will just do type check and act accordingly?","commit_id":"f127a5f388cfc0001e2e2ea55a2e16e0cb44f6b3"},{"author":{"_account_id":8846,"name":"Hao Wang","display_name":"Hao Wang","email":"sxmatch1986@gmail.com","username":"sxmatch"},"change_message_id":"30bd53af662324a1d055434bc173fdeea2267636","unresolved":false,"context_lines":[{"line_number":107,"context_line":"        source \u003d queue"},{"line_number":108,"context_line":"        now \u003d timeutils.utcnow_ts()"},{"line_number":109,"context_line":"        now_dt \u003d datetime.datetime.utcfromtimestamp(now)"},{"line_number":110,"context_line":"        expires \u003d now_dt + datetime.timedelta(seconds\u003dttl)"},{"line_number":111,"context_line":""},{"line_number":112,"context_line":"        if not self._queue_ctrl.exists(source, project):"},{"line_number":113,"context_line":"            raise errors.QueueDoesNotExist(source, project)"}],"source_content_type":"text/x-python","patch_set":10,"id":"7af24918_262d6cfe","line":110,"in_reply_to":"7af24918_204c349d","updated":"2016-03-03 14:42:31.000000000","message":"I have two option in my mind, one is we update the db field when Zaqar upgrade to M, so we only need to handle one type of format. But this is a little complex. Two is your option, I\u0027m also fine this. It looks easy to implement.","commit_id":"f127a5f388cfc0001e2e2ea55a2e16e0cb44f6b3"},{"author":{"_account_id":15054,"name":"wangxiyuan","email":"wangxiyuan1007@gmail.com","username":"wangxiyuan"},"change_message_id":"824be1a7044df6ebe82696104b85406ce5f0ca8a","unresolved":false,"context_lines":[{"line_number":108,"context_line":"        now \u003d timeutils.utcnow_ts()"},{"line_number":109,"context_line":"        now_dt \u003d datetime.datetime.utcfromtimestamp(now)"},{"line_number":110,"context_line":"        expires \u003d now_dt + datetime.timedelta(seconds\u003dttl)"},{"line_number":111,"context_line":""},{"line_number":112,"context_line":"        if not self._queue_ctrl.exists(source, project):"},{"line_number":113,"context_line":"            raise errors.QueueDoesNotExist(source, project)"},{"line_number":114,"context_line":"        try:"}],"source_content_type":"text/x-python","patch_set":10,"id":"7af24918_beea2a0d","line":111,"updated":"2016-03-03 13:52:14.000000000","message":"So the expires is date type now. But it is linux int in other resource or redis backend.","commit_id":"f127a5f388cfc0001e2e2ea55a2e16e0cb44f6b3"},{"author":{"_account_id":18683,"name":"Eva Balycheva","email":"ubershy@gmail.com","username":"eva"},"change_message_id":"0d1d32d787f79cce7d63b36a73e6d4b08c60462d","unresolved":false,"context_lines":[{"line_number":108,"context_line":"        now \u003d timeutils.utcnow_ts()"},{"line_number":109,"context_line":"        now_dt \u003d datetime.datetime.utcfromtimestamp(now)"},{"line_number":110,"context_line":"        expires \u003d now_dt + datetime.timedelta(seconds\u003dttl)"},{"line_number":111,"context_line":""},{"line_number":112,"context_line":"        if not self._queue_ctrl.exists(source, project):"},{"line_number":113,"context_line":"            raise errors.QueueDoesNotExist(source, project)"},{"line_number":114,"context_line":"        try:"}],"source_content_type":"text/x-python","patch_set":10,"id":"7af24918_9e500e34","line":111,"in_reply_to":"7af24918_beea2a0d","updated":"2016-03-03 14:10:56.000000000","message":"That\u0027s not correct.\nIn mongodb if we want the resource to automatically expire by database, the field should be in datetime format. It\u0027s easiest solution.\nFor now we have 3 expirable resources in zaqar: messages, subscriptions and claims.\nAs you can see, our expires field in mongodb driver in messages has datetime format. The expires field of claims doesn\u0027t have datetime format, because made claims in mongodb part of messages and we expire them differently.","commit_id":"f127a5f388cfc0001e2e2ea55a2e16e0cb44f6b3"}],"zaqar/transport/validation.py":[{"author":{"_account_id":18683,"name":"Eva Balycheva","email":"ubershy@gmail.com","username":"eva"},"change_message_id":"a46848a2e17fa0c2cf25e5fa5962f9d0b8bb7c18","unresolved":false,"context_lines":[{"line_number":334,"context_line":"            msg \u003d _(u\u0027TTL must be an integer or None.\u0027)"},{"line_number":335,"context_line":"            raise ValidationFailed(msg)"},{"line_number":336,"context_line":""},{"line_number":337,"context_line":"        if ttl and isinstance(ttl, int) and int(ttl) \u003c MIN_SUBSCRIPTION_TTL:"},{"line_number":338,"context_line":"            msg \u003d _(u\u0027The TTL for a subscription\u0027"},{"line_number":339,"context_line":"                    \u0027must be at least {1} seconds long.\u0027)"},{"line_number":340,"context_line":""}],"source_content_type":"text/x-python","patch_set":2,"id":"9a68dd71_11e783e5","line":337,"updated":"2016-01-21 03:34:45.000000000","message":"If ttl is an int, we don\u0027t need to cast this number to int.\n\nAlso add check for too large number. Otherwise Zaqar throws exception in the storage driver: OverflowError: normalized days too large to fit in a C int","commit_id":"99d95d98a354a3fb84b09ec124b6299349106851"},{"author":{"_account_id":15054,"name":"wangxiyuan","email":"wangxiyuan1007@gmail.com","username":"wangxiyuan"},"change_message_id":"507452c954c0ee09747f9b9920603b723cc94d21","unresolved":false,"context_lines":[{"line_number":336,"context_line":"            msg \u003d _(u\u0027TTL must be an integer.\u0027)"},{"line_number":337,"context_line":"            raise ValidationFailed(msg)"},{"line_number":338,"context_line":""},{"line_number":339,"context_line":"        if ttl and isinstance(ttl, int) and ttl \u003c MIN_SUBSCRIPTION_TTL:"},{"line_number":340,"context_line":"            msg \u003d _(u\u0027The TTL for a subscription \u0027"},{"line_number":341,"context_line":"                    \u0027must be at least {0} seconds long.\u0027)"},{"line_number":342,"context_line":"            raise ValidationFailed(msg, MIN_SUBSCRIPTION_TTL)"}],"source_content_type":"text/x-python","patch_set":3,"id":"5a5ae5dd_98f65cd6","line":339,"range":{"start_line":339,"start_character":18,"end_line":339,"end_character":39},"updated":"2016-02-03 07:38:37.000000000","message":"is this redundant? since L335 has checked it.","commit_id":"c3c9d82bf9d8461d175f67b812cf6f9a2fa60a22"},{"author":{"_account_id":12321,"name":"Ryan Brown","email":"rybrown@redhat.com","username":"ryansb"},"change_message_id":"405e87490f5f5d1306ca62dd5300921bcac90a6c","unresolved":false,"context_lines":[{"line_number":336,"context_line":"            msg \u003d _(u\u0027TTL must be an integer.\u0027)"},{"line_number":337,"context_line":"            raise ValidationFailed(msg)"},{"line_number":338,"context_line":""},{"line_number":339,"context_line":"        if ttl and isinstance(ttl, int) and ttl \u003c MIN_SUBSCRIPTION_TTL:"},{"line_number":340,"context_line":"            msg \u003d _(u\u0027The TTL for a subscription \u0027"},{"line_number":341,"context_line":"                    \u0027must be at least {0} seconds long.\u0027)"},{"line_number":342,"context_line":"            raise ValidationFailed(msg, MIN_SUBSCRIPTION_TTL)"}],"source_content_type":"text/x-python","patch_set":3,"id":"5a5ae5dd_e198eb6c","line":339,"range":{"start_line":339,"start_character":18,"end_line":339,"end_character":39},"in_reply_to":"5a5ae5dd_98f65cd6","updated":"2016-02-03 13:24:18.000000000","message":"Yes, this part of the condition does seem redundant","commit_id":"c3c9d82bf9d8461d175f67b812cf6f9a2fa60a22"},{"author":{"_account_id":18683,"name":"Eva Balycheva","email":"ubershy@gmail.com","username":"eva"},"change_message_id":"77156054d3afda5d0901659df3e1420e7cefbab1","unresolved":false,"context_lines":[{"line_number":345,"context_line":"        # TTL so as to get a long subscription."},{"line_number":346,"context_line":"        now \u003d timeutils.utcnow_ts()"},{"line_number":347,"context_line":"        now_dt \u003d datetime.datetime.utcfromtimestamp(now)"},{"line_number":348,"context_line":"        if now_dt + datetime.timedelta(seconds\u003dttl) \u003e datetime.datetime.max:"},{"line_number":349,"context_line":"            msg \u003d _(u\u0027The TTL seconds for a subscription plus current time\u0027"},{"line_number":350,"context_line":"                    \u0027 must less than {0}.\u0027)"},{"line_number":351,"context_line":"            raise ValidationFailed(msg, datetime.datetime.max)"}],"source_content_type":"text/x-python","patch_set":4,"id":"5a5ae5dd_957995ca","line":348,"updated":"2016-02-06 17:25:55.000000000","message":"The code under this condition never executes.\nWhen I pass a really big number as ttl, I get \"OverflowError: date value out of range\" in Zaqar console, and Zaqar returns 503 status code instead of 400.\n\nInstead, you can use this code snippet to make it work:\n\ntry:\n    now_dt + datetime.timedelta(seconds\u003dttl)\nexcept OverflowError:\n    msg \u003d _(u\u0027The TTL seconds for a subscription plus current time\u0027\n            \u0027 must less than {0}.\u0027)\n    raise ValidationFailed(msg, datetime.datetime.max)","commit_id":"5836f8acdcbf0899d39751f9b62582f54f9e65cb"},{"author":{"_account_id":18683,"name":"Eva Balycheva","email":"ubershy@gmail.com","username":"eva"},"change_message_id":"405a6b632b3aa0214af6c339ab4be5ea312423aa","unresolved":false,"context_lines":[{"line_number":348,"context_line":"        msg \u003d _(u\u0027The TTL seconds for a subscription plus current time\u0027"},{"line_number":349,"context_line":"                \u0027 must less than {0}.\u0027)"},{"line_number":350,"context_line":"        try:"},{"line_number":351,"context_line":"            if (now_dt + datetime.timedelta(seconds\u003dttl) \u003e"},{"line_number":352,"context_line":"                    datetime.datetime.max):"},{"line_number":353,"context_line":"                raise ValidationFailed(msg, datetime.datetime.max)"},{"line_number":354,"context_line":"        except OverflowError:"},{"line_number":355,"context_line":"            raise ValidationFailed(msg, datetime.datetime.max)"}],"source_content_type":"text/x-python","patch_set":5,"id":"5a5ae5dd_733943d8","line":352,"range":{"start_line":351,"start_character":16,"end_line":352,"end_character":41},"updated":"2016-02-09 03:37:51.000000000","message":"Is there such TTL number the user can pass, to make this condition evaluate to True?","commit_id":"9f01c7c69e9b3a75780a922ea8d623225d850770"},{"author":{"_account_id":18683,"name":"Eva Balycheva","email":"ubershy@gmail.com","username":"eva"},"change_message_id":"6e0b9225481d4222d6b4e0150647f2e4fb202b25","unresolved":false,"context_lines":[{"line_number":348,"context_line":"        msg \u003d _(u\u0027The TTL seconds for a subscription plus current time\u0027"},{"line_number":349,"context_line":"                \u0027 must less than {0}.\u0027)"},{"line_number":350,"context_line":"        try:"},{"line_number":351,"context_line":"            if (now_dt + datetime.timedelta(seconds\u003dttl) \u003e"},{"line_number":352,"context_line":"                    datetime.datetime.max):"},{"line_number":353,"context_line":"                raise ValidationFailed(msg, datetime.datetime.max)"},{"line_number":354,"context_line":"        except OverflowError:"},{"line_number":355,"context_line":"            raise ValidationFailed(msg, datetime.datetime.max)"}],"source_content_type":"text/x-python","patch_set":5,"id":"3a57f1b5_93e4f13b","line":352,"range":{"start_line":351,"start_character":16,"end_line":352,"end_character":41},"in_reply_to":"3a57f1b5_84da7b77","updated":"2016-02-10 04:17:12.000000000","message":"No, in this new test case the condition never evaluates to True.\nWhen we pass reasonable number, the condition evaluates to False. When we pass very big number, the condition is not able to evaluate at all, because OverflowError exception is raised before.\n\nSo there\u0027s no need in condition. It would be enough to just check if the code:\n\"now_dt + datetime.timedelta(seconds\u003dttl)\"\nis able to execute without exception to pass validation.\n\nBut okay, if you insist, we can keep this condition which never evaluates to True.","commit_id":"9f01c7c69e9b3a75780a922ea8d623225d850770"},{"author":{"_account_id":6484,"name":"Feilong Wang","email":"hustemb@gmail.com","username":"flwang"},"change_message_id":"1a5a261cdbc444aaee7dc21f464609e0ceb02dc0","unresolved":false,"context_lines":[{"line_number":348,"context_line":"        msg \u003d _(u\u0027The TTL seconds for a subscription plus current time\u0027"},{"line_number":349,"context_line":"                \u0027 must less than {0}.\u0027)"},{"line_number":350,"context_line":"        try:"},{"line_number":351,"context_line":"            if (now_dt + datetime.timedelta(seconds\u003dttl) \u003e"},{"line_number":352,"context_line":"                    datetime.datetime.max):"},{"line_number":353,"context_line":"                raise ValidationFailed(msg, datetime.datetime.max)"},{"line_number":354,"context_line":"        except OverflowError:"},{"line_number":355,"context_line":"            raise ValidationFailed(msg, datetime.datetime.max)"}],"source_content_type":"text/x-python","patch_set":5,"id":"3a57f1b5_84da7b77","line":352,"range":{"start_line":351,"start_character":16,"end_line":352,"end_character":41},"in_reply_to":"5a5ae5dd_733943d8","updated":"2016-02-09 20:58:06.000000000","message":"See https://review.openstack.org/#/c/270464/5/zaqar/tests/unit/transport/wsgi/v2_0/test_validation.py","commit_id":"9f01c7c69e9b3a75780a922ea8d623225d850770"},{"author":{"_account_id":18683,"name":"Eva Balycheva","email":"ubershy@gmail.com","username":"eva"},"change_message_id":"f160014fccf6f7673eed50befd9a488f032372b4","unresolved":false,"context_lines":[{"line_number":298,"context_line":"        :param subscription: dict of subscription"},{"line_number":299,"context_line":"        :raises: ValidationFailed if the subscription is invalid."},{"line_number":300,"context_line":"        \"\"\""},{"line_number":301,"context_line":"        for p in (\u0027subscriber\u0027, \u0027ttl\u0027, \u0027options\u0027):"},{"line_number":302,"context_line":"            if p not in subscription.keys():"},{"line_number":303,"context_line":"                raise ValidationFailed(_(u\u0027Missing parameter %s in body.\u0027) % p)"},{"line_number":304,"context_line":""}],"source_content_type":"text/x-python","patch_set":6,"id":"dae33548_865a0782","line":301,"range":{"start_line":301,"start_character":17,"end_line":301,"end_character":49},"updated":"2016-02-15 14:12:41.000000000","message":"Please check which fields are really required now.","commit_id":"f513bbffc2c78cd079effa20cf35694b37f0c2af"},{"author":{"_account_id":18683,"name":"Eva Balycheva","email":"ubershy@gmail.com","username":"eva"},"change_message_id":"f160014fccf6f7673eed50befd9a488f032372b4","unresolved":false,"context_lines":[{"line_number":332,"context_line":"            raise ValidationFailed(msg)"},{"line_number":333,"context_line":""},{"line_number":334,"context_line":"        ttl \u003d subscription.get(\u0027ttl\u0027, None)"},{"line_number":335,"context_line":"        if ttl and not isinstance(ttl, int):"},{"line_number":336,"context_line":"            msg \u003d _(u\u0027TTL must be an integer.\u0027)"},{"line_number":337,"context_line":"            raise ValidationFailed(msg)"},{"line_number":338,"context_line":""}],"source_content_type":"text/x-python","patch_set":6,"id":"dae33548_a6cbcb71","line":335,"range":{"start_line":335,"start_character":8,"end_line":335,"end_character":14},"updated":"2016-02-15 14:12:41.000000000","message":"I think we should put all code below in this method under single condition: \"if ttl\", so we wouldn\u0027t repeat ourselves.\n\nThis will also make L346-L355 code execute without errors, if ttl is None.","commit_id":"f513bbffc2c78cd079effa20cf35694b37f0c2af"},{"author":{"_account_id":12321,"name":"Ryan Brown","email":"rybrown@redhat.com","username":"ryansb"},"change_message_id":"fe23fa7cd054a4ce3cdaf6d0988f0f89d36ac37f","unresolved":false,"context_lines":[{"line_number":346,"context_line":"        now \u003d timeutils.utcnow_ts()"},{"line_number":347,"context_line":"        now_dt \u003d datetime.datetime.utcfromtimestamp(now)"},{"line_number":348,"context_line":"        msg \u003d _(u\u0027The TTL seconds for a subscription plus current time\u0027"},{"line_number":349,"context_line":"                \u0027 must less than {0}.\u0027)"},{"line_number":350,"context_line":"        try:"},{"line_number":351,"context_line":"            # NOTE(flwang): If below expression works, then we believe the ttl"},{"line_number":352,"context_line":"            # is acceptable otherwise it exceeds the max time of python."}],"source_content_type":"text/x-python","patch_set":6,"id":"dae33548_aa5c1c26","line":349,"updated":"2016-02-15 20:44:32.000000000","message":"\"must be less than\"","commit_id":"f513bbffc2c78cd079effa20cf35694b37f0c2af"},{"author":{"_account_id":12321,"name":"Ryan Brown","email":"rybrown@redhat.com","username":"ryansb"},"change_message_id":"fe23fa7cd054a4ce3cdaf6d0988f0f89d36ac37f","unresolved":false,"context_lines":[{"line_number":352,"context_line":"            # is acceptable otherwise it exceeds the max time of python."},{"line_number":353,"context_line":"            now_dt + datetime.timedelta(seconds\u003dttl)"},{"line_number":354,"context_line":"        except OverflowError:"},{"line_number":355,"context_line":"            raise ValidationFailed(msg, datetime.datetime.max)"},{"line_number":356,"context_line":""},{"line_number":357,"context_line":"    def subscription_listing(self, limit\u003dNone, **kwargs):"},{"line_number":358,"context_line":"        \"\"\"Restrictions involving a list of subscriptions."}],"source_content_type":"text/x-python","patch_set":6,"id":"dae33548_0a42683e","line":355,"updated":"2016-02-15 20:44:32.000000000","message":"Nice catch here +1","commit_id":"f513bbffc2c78cd079effa20cf35694b37f0c2af"},{"author":{"_account_id":8846,"name":"Hao Wang","display_name":"Hao Wang","email":"sxmatch1986@gmail.com","username":"sxmatch"},"change_message_id":"96dea7dc7666974fb3666f21240b21e864789a49","unresolved":false,"context_lines":[{"line_number":337,"context_line":"                msg \u003d _(u\u0027TTL must be an integer.\u0027)"},{"line_number":338,"context_line":"                raise ValidationFailed(msg)"},{"line_number":339,"context_line":""},{"line_number":340,"context_line":"            if ttl \u003c MIN_SUBSCRIPTION_TTL:"},{"line_number":341,"context_line":"                msg \u003d _(u\u0027The TTL for a subscription \u0027"},{"line_number":342,"context_line":"                        \u0027must be at least {0} seconds long.\u0027)"},{"line_number":343,"context_line":"                raise ValidationFailed(msg, MIN_SUBSCRIPTION_TTL)"}],"source_content_type":"text/x-python","patch_set":10,"id":"9aed3d3a_a27aee21","line":340,"range":{"start_line":340,"start_character":21,"end_line":340,"end_character":42},"updated":"2016-03-01 09:32:51.000000000","message":"Only a suggestion: Do we should consider to put those constants to conf file, that admin could adjust those value.","commit_id":"f127a5f388cfc0001e2e2ea55a2e16e0cb44f6b3"},{"author":{"_account_id":18683,"name":"Eva Balycheva","email":"ubershy@gmail.com","username":"eva"},"change_message_id":"362dfe82824c5bd9a07ab860311b73512c856af1","unresolved":false,"context_lines":[{"line_number":337,"context_line":"                msg \u003d _(u\u0027TTL must be an integer.\u0027)"},{"line_number":338,"context_line":"                raise ValidationFailed(msg)"},{"line_number":339,"context_line":""},{"line_number":340,"context_line":"            if ttl \u003c MIN_SUBSCRIPTION_TTL:"},{"line_number":341,"context_line":"                msg \u003d _(u\u0027The TTL for a subscription \u0027"},{"line_number":342,"context_line":"                        \u0027must be at least {0} seconds long.\u0027)"},{"line_number":343,"context_line":"                raise ValidationFailed(msg, MIN_SUBSCRIPTION_TTL)"}],"source_content_type":"text/x-python","patch_set":10,"id":"7af24918_5dd3b038","line":340,"range":{"start_line":340,"start_character":21,"end_line":340,"end_character":42},"in_reply_to":"7af24918_0277033b","updated":"2016-03-01 21:02:22.000000000","message":"I think the same as Fei Long.","commit_id":"f127a5f388cfc0001e2e2ea55a2e16e0cb44f6b3"},{"author":{"_account_id":8846,"name":"Hao Wang","display_name":"Hao Wang","email":"sxmatch1986@gmail.com","username":"sxmatch"},"change_message_id":"a8ae598ec3c67575e598f4aeab74b88af218b437","unresolved":false,"context_lines":[{"line_number":337,"context_line":"                msg \u003d _(u\u0027TTL must be an integer.\u0027)"},{"line_number":338,"context_line":"                raise ValidationFailed(msg)"},{"line_number":339,"context_line":""},{"line_number":340,"context_line":"            if ttl \u003c MIN_SUBSCRIPTION_TTL:"},{"line_number":341,"context_line":"                msg \u003d _(u\u0027The TTL for a subscription \u0027"},{"line_number":342,"context_line":"                        \u0027must be at least {0} seconds long.\u0027)"},{"line_number":343,"context_line":"                raise ValidationFailed(msg, MIN_SUBSCRIPTION_TTL)"}],"source_content_type":"text/x-python","patch_set":10,"id":"7af24918_2d943241","line":340,"range":{"start_line":340,"start_character":21,"end_line":340,"end_character":42},"in_reply_to":"7af24918_5dd3b038","updated":"2016-03-03 13:11:20.000000000","message":"Emm, it\u0027s also fine to me, I can accept this. :)","commit_id":"f127a5f388cfc0001e2e2ea55a2e16e0cb44f6b3"},{"author":{"_account_id":6484,"name":"Feilong Wang","email":"hustemb@gmail.com","username":"flwang"},"change_message_id":"90fdd22d0cccb12eb616eae17b5c3edbed7356ce","unresolved":false,"context_lines":[{"line_number":337,"context_line":"                msg \u003d _(u\u0027TTL must be an integer.\u0027)"},{"line_number":338,"context_line":"                raise ValidationFailed(msg)"},{"line_number":339,"context_line":""},{"line_number":340,"context_line":"            if ttl \u003c MIN_SUBSCRIPTION_TTL:"},{"line_number":341,"context_line":"                msg \u003d _(u\u0027The TTL for a subscription \u0027"},{"line_number":342,"context_line":"                        \u0027must be at least {0} seconds long.\u0027)"},{"line_number":343,"context_line":"                raise ValidationFailed(msg, MIN_SUBSCRIPTION_TTL)"}],"source_content_type":"text/x-python","patch_set":10,"id":"7af24918_0277033b","line":340,"range":{"start_line":340,"start_character":21,"end_line":340,"end_character":42},"in_reply_to":"9aed3d3a_a27aee21","updated":"2016-03-01 20:44:55.000000000","message":"Personally, I don\u0027t think admin/operator really care about the min value. Generally, they only care about the max value. Thoughts?","commit_id":"f127a5f388cfc0001e2e2ea55a2e16e0cb44f6b3"}]}
