{"action":"closed","issue":{"url":"https://api.github.com/repos/translate/pootle/issues/4219","repository_url":"https://api.github.com/repos/translate/pootle","labels_url":"https://api.github.com/repos/translate/pootle/issues/4219/labels{/name}","comments_url":"https://api.github.com/repos/translate/pootle/issues/4219/comments","events_url":"https://api.github.com/repos/translate/pootle/issues/4219/events","html_url":"https://github.com/translate/pootle/issues/4219","id":118666324,"number":4219,"title":"Stats: clear and handle dirty counts in refresh_stats command","user":{"login":"ta2-1","id":682845,"avatar_url":"https://avatars.githubusercontent.com/u/682845?v=3","gravatar_id":"","url":"https://api.github.com/users/ta2-1","html_url":"https://github.com/ta2-1","followers_url":"https://api.github.com/users/ta2-1/followers","following_url":"https://api.github.com/users/ta2-1/following{/other_user}","gists_url":"https://api.github.com/users/ta2-1/gists{/gist_id}","starred_url":"https://api.github.com/users/ta2-1/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ta2-1/subscriptions","organizations_url":"https://api.github.com/users/ta2-1/orgs","repos_url":"https://api.github.com/users/ta2-1/repos","events_url":"https://api.github.com/users/ta2-1/events{/privacy}","received_events_url":"https://api.github.com/users/ta2-1/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":{"login":"ta2-1","id":682845,"avatar_url":"https://avatars.githubusercontent.com/u/682845?v=3","gravatar_id":"","url":"https://api.github.com/users/ta2-1","html_url":"https://github.com/ta2-1","followers_url":"https://api.github.com/users/ta2-1/followers","following_url":"https://api.github.com/users/ta2-1/following{/other_user}","gists_url":"https://api.github.com/users/ta2-1/gists{/gist_id}","starred_url":"https://api.github.com/users/ta2-1/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ta2-1/subscriptions","organizations_url":"https://api.github.com/users/ta2-1/orgs","repos_url":"https://api.github.com/users/ta2-1/repos","events_url":"https://api.github.com/users/ta2-1/events{/privacy}","received_events_url":"https://api.github.com/users/ta2-1/received_events","type":"User","site_admin":false},"milestone":{"url":"https://api.github.com/repos/translate/pootle/milestones/25","html_url":"https://github.com/translate/pootle/milestones/2.8.0","labels_url":"https://api.github.com/repos/translate/pootle/milestones/25/labels","id":1436949,"number":25,"title":"2.8.0","description":"","creator":{"login":"phlax","id":454682,"avatar_url":"https://avatars.githubusercontent.com/u/454682?v=3","gravatar_id":"","url":"https://api.github.com/users/phlax","html_url":"https://github.com/phlax","followers_url":"https://api.github.com/users/phlax/followers","following_url":"https://api.github.com/users/phlax/following{/other_user}","gists_url":"https://api.github.com/users/phlax/gists{/gist_id}","starred_url":"https://api.github.com/users/phlax/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/phlax/subscriptions","organizations_url":"https://api.github.com/users/phlax/orgs","repos_url":"https://api.github.com/users/phlax/repos","events_url":"https://api.github.com/users/phlax/events{/privacy}","received_events_url":"https://api.github.com/users/phlax/received_events","type":"User","site_admin":false},"open_issues":16,"closed_issues":69,"state":"open","created_at":"2015-12-01T09:07:40Z","updated_at":"2016-03-29T13:45:02Z","due_on":"2016-03-17T00:00:00Z","closed_at":null},"comments":9,"created_at":"2015-11-24T17:44:49Z","updated_at":"2016-03-29T13:45:02Z","closed_at":"2016-03-29T13:45:02Z","body":"If we have dirty items it can mean:\r\n\r\n1. the stats are being calculated, in case there are pending jobs;\r\n2. the stats calculation didn't complete successfully, in case there are failed jobs;\r\n3. there was some other issue with the worker, in case there are no pending/failed jobs;\r\n\r\nHow these dirty items can disappear?\r\n\r\n1. automatically after pending jobs are finished;\r\n2. after admin run `retry_failed_jobs` command;\r\n3. after dirty stats are removed manually;\r\n\r\nSometimes `retry_failed_jobs` command can be useless in 2nd case. Jobs can be failed again and again. \r\n\r\nHow to handle with dirty items? We can describe some things in #4216.\r\nBut we can expect to have no dirty stats after running of `refresh_stats` command.\r\n\r\nLet's think how we can safely remove all dirty flags before refresh.\r\n`redis-cli del pootle:dirty:treeitems` can be added in the beginning of `refresh_stats` in the simplest case when we refresh all stats but it can be run if there are no pending tasks and `rqworker` is stopped."}}