{"action":"closed","issue":{"url":"https://api.github.com/repos/CartoDB/cartodb/issues/9624","repository_url":"https://api.github.com/repos/CartoDB/cartodb","labels_url":"https://api.github.com/repos/CartoDB/cartodb/issues/9624/labels{/name}","comments_url":"https://api.github.com/repos/CartoDB/cartodb/issues/9624/comments","events_url":"https://api.github.com/repos/CartoDB/cartodb/issues/9624/events","html_url":"https://github.com/CartoDB/cartodb/issues/9624","id":174316168,"number":9624,"title":"Import/Sync log lines can be out of order","user":{"login":"jgoizueta","id":5909,"avatar_url":"https://avatars.githubusercontent.com/u/5909?v=3","gravatar_id":"","url":"https://api.github.com/users/jgoizueta","html_url":"https://github.com/jgoizueta","followers_url":"https://api.github.com/users/jgoizueta/followers","following_url":"https://api.github.com/users/jgoizueta/following{/other_user}","gists_url":"https://api.github.com/users/jgoizueta/gists{/gist_id}","starred_url":"https://api.github.com/users/jgoizueta/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jgoizueta/subscriptions","organizations_url":"https://api.github.com/users/jgoizueta/orgs","repos_url":"https://api.github.com/users/jgoizueta/repos","events_url":"https://api.github.com/users/jgoizueta/events{/privacy}","received_events_url":"https://api.github.com/users/jgoizueta/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/CartoDB/cartodb/labels/bug","name":"bug","color":"fc2929"},{"url":"https://api.github.com/repos/CartoDB/cartodb/labels/Data-services","name":"Data-services","color":"fef2c0"}],"state":"closed","locked":false,"assignee":{"login":"jgoizueta","id":5909,"avatar_url":"https://avatars.githubusercontent.com/u/5909?v=3","gravatar_id":"","url":"https://api.github.com/users/jgoizueta","html_url":"https://github.com/jgoizueta","followers_url":"https://api.github.com/users/jgoizueta/followers","following_url":"https://api.github.com/users/jgoizueta/following{/other_user}","gists_url":"https://api.github.com/users/jgoizueta/gists{/gist_id}","starred_url":"https://api.github.com/users/jgoizueta/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jgoizueta/subscriptions","organizations_url":"https://api.github.com/users/jgoizueta/orgs","repos_url":"https://api.github.com/users/jgoizueta/repos","events_url":"https://api.github.com/users/jgoizueta/events{/privacy}","received_events_url":"https://api.github.com/users/jgoizueta/received_events","type":"User","site_admin":false},"assignees":[{"login":"jgoizueta","id":5909,"avatar_url":"https://avatars.githubusercontent.com/u/5909?v=3","gravatar_id":"","url":"https://api.github.com/users/jgoizueta","html_url":"https://github.com/jgoizueta","followers_url":"https://api.github.com/users/jgoizueta/followers","following_url":"https://api.github.com/users/jgoizueta/following{/other_user}","gists_url":"https://api.github.com/users/jgoizueta/gists{/gist_id}","starred_url":"https://api.github.com/users/jgoizueta/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jgoizueta/subscriptions","organizations_url":"https://api.github.com/users/jgoizueta/orgs","repos_url":"https://api.github.com/users/jgoizueta/repos","events_url":"https://api.github.com/users/jgoizueta/events{/privacy}","received_events_url":"https://api.github.com/users/jgoizueta/received_events","type":"User","site_admin":false}],"milestone":null,"comments":0,"created_at":"2016-08-31T16:16:28Z","updated_at":"2016-09-05T10:14:41Z","closed_at":"2016-09-05T10:14:41Z","body":"Each time `entries` is generated (when an updated `Log` is stored), the circular buffer used when the number of log lines is large (over 500 lines) is dumped in the stored order, but entries starting at the circular array pointer `@circular_index` are actually older than the preceding entries in the array (since they're most recently overwritten).\r\n\r\nThe problem is [here](https://github.com/CartoDB/cartodb/blob/1b6dac2daf2810d43904653d6558a1d3ef52de34/app/models/log.rb#L163)\r\n\r\nSee https://github.com/CartoDB/cartodb/issues/9615#issuecomment-243737746\r\n\r\nAlso, I think the 'minus one' [here](https://github.com/CartoDB/cartodb/blob/1b6dac2daf2810d43904653d6558a1d3ef52de34/app/models/log.rb#L163) should be removed (as the index points to the place where the next appended line will be stored). And I'd also add an  `else` to that conditional, setting `@circular_index` to zero (we start adding lines at the start of an empty buffer)."}}
{"actor":{"display_login":"jgoizueta"}}