{"action":"opened","issue":{"url":"https://api.github.com/repos/gophercloud/gophercloud/issues/1054","repository_url":"https://api.github.com/repos/gophercloud/gophercloud","labels_url":"https://api.github.com/repos/gophercloud/gophercloud/issues/1054/labels{/name}","comments_url":"https://api.github.com/repos/gophercloud/gophercloud/issues/1054/comments","events_url":"https://api.github.com/repos/gophercloud/gophercloud/issues/1054/events","html_url":"https://github.com/gophercloud/gophercloud/issues/1054","id":334140322,"node_id":"MDU6SXNzdWUzMzQxNDAzMjI=","number":1054,"title":"AllPages is making one extra call to OpenStack API","user":{"login":"garbage-collector","id":8505651,"node_id":"MDQ6VXNlcjg1MDU2NTE=","avatar_url":"https://avatars3.githubusercontent.com/u/8505651?v=4","gravatar_id":"","url":"https://api.github.com/users/garbage-collector","html_url":"https://github.com/garbage-collector","followers_url":"https://api.github.com/users/garbage-collector/followers","following_url":"https://api.github.com/users/garbage-collector/following{/other_user}","gists_url":"https://api.github.com/users/garbage-collector/gists{/gist_id}","starred_url":"https://api.github.com/users/garbage-collector/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/garbage-collector/subscriptions","organizations_url":"https://api.github.com/users/garbage-collector/orgs","repos_url":"https://api.github.com/users/garbage-collector/repos","events_url":"https://api.github.com/users/garbage-collector/events{/privacy}","received_events_url":"https://api.github.com/users/garbage-collector/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-06-20T15:48:24Z","updated_at":"2018-06-20T15:48:24Z","closed_at":null,"author_association":"NONE","body":"Hi !\r\n\r\nWhile starting to use the gophercloud library, I noticed that using the AllPages() function (https://github.com/gophercloud/gophercloud/blob/master/pagination/pager.go#L125) from the pager ends with performing one not needed call to the OpenStack.\r\n\r\nFor listing flavors, for example, it performs two calls to OpenStack API, the first one to get the flavor list.\r\n\r\nThe first call is done to get the \"testPage\" (https://github.com/gophercloud/gophercloud/blob/master/pagination/pager.go#L132).\r\nThe second call is done to get results by calling the EachPage function.\r\n\r\nSo if you have N pages of results, it looks like the code will perform N+1 calls to the OpenStack API.\r\n\r\nThis looks like an issue as all GET calls will end with a higher response time because of the double calls.\r\n\r\nIs this a normal behavior ?\r\n\r\nOne way to fix it is to consider the \"testPage\" as a \"firstPage\" but I prefer to discuss about the issue before creating a PR.\r\n\r\nThanks"}}
{"actor":{"display_login":"garbage-collector"}}