{"action":"created","comment":{"url":"https://api.github.com/repos/CanalTP/navitia/pulls/comments/83172607","pull_request_review_id":4030670,"id":83172607,"diff_hunk":"@@ -103,20 +105,25 @@ def wrapper(*args, **kwargs):\n             logging.debug('args: %s -- kwargs: %s', args, kwargs)\n             job = models.Job.query.get(job_id)\n             logger = get_instance_logger(job.instance)\n-            lock = redis.lock('tyr.lock|' + job.instance.name, timeout=self.timeout)\n-            if not lock.acquire(blocking=False):\n+            task = args[func.func_code.co_varnames.index('self')]\n+            try:\n+                lock = redis.lock('tyr.lock|' + job.instance.name, timeout=self.timeout)\n+                locked = lock.acquire(blocking=False)\n+            except ConnectionError:\n+                logging.exception('Exception with redis while locking. Retrying in 10sec')\n+                task.retry(countdown=10, max_retries=10)\n+            if not locked:\n                 countdown = 300\n-                logger.info('lock on %s retry %s in %s sec',\n-                            job.instance.name, func.__name__, countdown)\n-                task = args[func.func_code.co_varnames.index('self')]\n+                logger.info('lock on %s retry %s in %s sec', job.instance.name, func.__name__, countdown)\n                 task.retry(countdown=countdown, max_retries=10)\n             else:\n                 try:\n                     logger.debug('lock acquired on %s for %s', job.instance.name, func.__name__)\n                     return func(*args, **kwargs)\n                 finally:\n                     logger.debug('release lock on %s for %s', job.instance.name, func.__name__)\n-                    lock.release()\n+                    #sometime we have been disctonnected from redis when we want to release the lock, so we retry only the release","path":"source/tyr/tyr/binarisation.py","position":36,"original_position":36,"commit_id":"958e581c2edb6bb5a694a6328407baf8487f671f","original_commit_id":"958e581c2edb6bb5a694a6328407baf8487f671f","user":{"login":"pbougue","id":12812530,"avatar_url":"https://avatars.githubusercontent.com/u/12812530?v=3","gravatar_id":"","url":"https://api.github.com/users/pbougue","html_url":"https://github.com/pbougue","followers_url":"https://api.github.com/users/pbougue/followers","following_url":"https://api.github.com/users/pbougue/following{/other_user}","gists_url":"https://api.github.com/users/pbougue/gists{/gist_id}","starred_url":"https://api.github.com/users/pbougue/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pbougue/subscriptions","organizations_url":"https://api.github.com/users/pbougue/orgs","repos_url":"https://api.github.com/users/pbougue/repos","events_url":"https://api.github.com/users/pbougue/events{/privacy}","received_events_url":"https://api.github.com/users/pbougue/received_events","type":"User","site_admin":false},"body":"minor: sometime`s`, `disconnected`, line length","created_at":"2016-10-13T09:09:07Z","updated_at":"2016-10-13T09:09:07Z","html_url":"https://github.com/CanalTP/navitia/pull/1825#discussion_r83172607","pull_request_url":"https://api.github.com/repos/CanalTP/navitia/pulls/1825","_links":{"self":{"href":"https://api.github.com/repos/CanalTP/navitia/pulls/comments/83172607"},"html":{"href":"https://github.com/CanalTP/navitia/pull/1825#discussion_r83172607"},"pull_request":{"href":"https://api.github.com/repos/CanalTP/navitia/pulls/1825"}}},"pull_request":{"url":"https://api.github.com/repos/CanalTP/navitia/pulls/1825","id":89148399,"html_url":"https://github.com/CanalTP/navitia/pull/1825","diff_url":"https://github.com/CanalTP/navitia/pull/1825.diff","patch_url":"https://github.com/CanalTP/navitia/pull/1825.patch","issue_url":"https://api.github.com/repos/CanalTP/navitia/issues/1825","number":1825,"state":"open","locked":false,"title":"tyr: add retrying when redis error while locking","user":{"login":"kinnou02","id":448185,"avatar_url":"https://avatars.githubusercontent.com/u/448185?v=3","gravatar_id":"","url":"https://api.github.com/users/kinnou02","html_url":"https://github.com/kinnou02","followers_url":"https://api.github.com/users/kinnou02/followers","following_url":"https://api.github.com/users/kinnou02/following{/other_user}","gists_url":"https://api.github.com/users/kinnou02/gists{/gist_id}","starred_url":"https://api.github.com/users/kinnou02/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kinnou02/subscriptions","organizations_url":"https://api.github.com/users/kinnou02/orgs","repos_url":"https://api.github.com/users/kinnou02/repos","events_url":"https://api.github.com/users/kinnou02/events{/privacy}","received_events_url":"https://api.github.com/users/kinnou02/received_events","type":"User","site_admin":false},"body":"We retry the full task if the error happens while locking. If it's while\r\nreleasing the lock we only retry to release it and if we don't success\r\nafter 5 times we continue. Hopefuly we won't need to do something on that\r\ninstance before the timeout of the lock :(\r\nRefer to: http://jira.canaltp.fr/browse/NAVITIAII-2171","created_at":"2016-10-13T07:20:55Z","updated_at":"2016-10-13T09:10:56Z","closed_at":null,"merged_at":null,"merge_commit_sha":"a102a27700b475744016f6d37311d6d767818b0a","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/CanalTP/navitia/pulls/1825/commits","review_comments_url":"https://api.github.com/repos/CanalTP/navitia/pulls/1825/comments","review_comment_url":"https://api.github.com/repos/CanalTP/navitia/pulls/comments{/number}","comments_url":"https://api.github.com/repos/CanalTP/navitia/issues/1825/comments","statuses_url":"https://api.github.com/repos/CanalTP/navitia/statuses/958e581c2edb6bb5a694a6328407baf8487f671f","head":{"label":"kinnou02:tyr-retrying-redis","ref":"tyr-retrying-redis","sha":"958e581c2edb6bb5a694a6328407baf8487f671f","user":{"login":"kinnou02","id":448185,"avatar_url":"https://avatars.githubusercontent.com/u/448185?v=3","gravatar_id":"","url":"https://api.github.com/users/kinnou02","html_url":"https://github.com/kinnou02","followers_url":"https://api.github.com/users/kinnou02/followers","following_url":"https://api.github.com/users/kinnou02/following{/other_user}","gists_url":"https://api.github.com/users/kinnou02/gists{/gist_id}","starred_url":"https://api.github.com/users/kinnou02/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kinnou02/subscriptions","organizations_url":"https://api.github.com/users/kinnou02/orgs","repos_url":"https://api.github.com/users/kinnou02/repos","events_url":"https://api.github.com/users/kinnou02/events{/privacy}","received_events_url":"https://api.github.com/users/kinnou02/received_events","type":"User","site_admin":false},"repo":{"id":19144326,"name":"navitia","full_name":"kinnou02/navitia","owner":{"login":"kinnou02","id":448185,"avatar_url":"https://avatars.githubusercontent.com/u/448185?v=3","gravatar_id":"","url":"https://api.github.com/users/kinnou02","html_url":"https://github.com/kinnou02","followers_url":"https://api.github.com/users/kinnou02/followers","following_url":"https://api.github.com/users/kinnou02/following{/other_user}","gists_url":"https://api.github.com/users/kinnou02/gists{/gist_id}","starred_url":"https://api.github.com/users/kinnou02/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kinnou02/subscriptions","organizations_url":"https://api.github.com/users/kinnou02/orgs","repos_url":"https://api.github.com/users/kinnou02/repos","events_url":"https://api.github.com/users/kinnou02/events{/privacy}","received_events_url":"https://api.github.com/users/kinnou02/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/kinnou02/navitia","description":null,"fork":true,"url":"https://api.github.com/repos/kinnou02/navitia","forks_url":"https://api.github.com/repos/kinnou02/navitia/forks","keys_url":"https://api.github.com/repos/kinnou02/navitia/keys{/key_id}","collaborators_url":"https://api.github.com/repos/kinnou02/navitia/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/kinnou02/navitia/teams","hooks_url":"https://api.github.com/repos/kinnou02/navitia/hooks","issue_events_url":"https://api.github.com/repos/kinnou02/navitia/issues/events{/number}","events_url":"https://api.github.com/repos/kinnou02/navitia/events","assignees_url":"https://api.github.com/repos/kinnou02/navitia/assignees{/user}","branches_url":"https://api.github.com/repos/kinnou02/navitia/branches{/branch}","tags_url":"https://api.github.com/repos/kinnou02/navitia/tags","blobs_url":"https://api.github.com/repos/kinnou02/navitia/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/kinnou02/navitia/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/kinnou02/navitia/git/refs{/sha}","trees_url":"https://api.github.com/repos/kinnou02/navitia/git/trees{/sha}","statuses_url":"https://api.github.com/repos/kinnou02/navitia/statuses/{sha}","languages_url":"https://api.github.com/repos/kinnou02/navitia/languages","stargazers_url":"https://api.github.com/repos/kinnou02/navitia/stargazers","contributors_url":"https://api.github.com/repos/kinnou02/navitia/contributors","subscribers_url":"https://api.github.com/repos/kinnou02/navitia/subscribers","subscription_url":"https://api.github.com/repos/kinnou02/navitia/subscription","commits_url":"https://api.github.com/repos/kinnou02/navitia/commits{/sha}","git_commits_url":"https://api.github.com/repos/kinnou02/navitia/git/commits{/sha}","comments_url":"https://api.github.com/repos/kinnou02/navitia/comments{/number}","issue_comment_url":"https://api.github.com/repos/kinnou02/navitia/issues/comments{/number}","contents_url":"https://api.github.com/repos/kinnou02/navitia/contents/{+path}","compare_url":"https://api.github.com/repos/kinnou02/navitia/compare/{base}...{head}","merges_url":"https://api.github.com/repos/kinnou02/navitia/merges","archive_url":"https://api.github.com/repos/kinnou02/navitia/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/kinnou02/navitia/downloads","issues_url":"https://api.github.com/repos/kinnou02/navitia/issues{/number}","pulls_url":"https://api.github.com/repos/kinnou02/navitia/pulls{/number}","milestones_url":"https://api.github.com/repos/kinnou02/navitia/milestones{/number}","notifications_url":"https://api.github.com/repos/kinnou02/navitia/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/kinnou02/navitia/labels{/name}","releases_url":"https://api.github.com/repos/kinnou02/navitia/releases{/id}","deployments_url":"https://api.github.com/repos/kinnou02/navitia/deployments","created_at":"2014-04-25T11:49:18Z","updated_at":"2015-04-02T13:46:49Z","pushed_at":"2016-10-13T07:20:14Z","git_url":"git://github.com/kinnou02/navitia.git","ssh_url":"git@github.com:kinnou02/navitia.git","clone_url":"https://github.com/kinnou02/navitia.git","svn_url":"https://github.com/kinnou02/navitia","homepage":"http://www.navitia.io/","size":33950,"stargazers_count":0,"watchers_count":0,"language":"C++","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"dev"}},"base":{"label":"CanalTP:dev","ref":"dev","sha":"d57b1ba828270b4bcbfce91b1add7e346bfe7d51","user":{"login":"CanalTP","id":2743985,"avatar_url":"https://avatars.githubusercontent.com/u/2743985?v=3","gravatar_id":"","url":"https://api.github.com/users/CanalTP","html_url":"https://github.com/CanalTP","followers_url":"https://api.github.com/users/CanalTP/followers","following_url":"https://api.github.com/users/CanalTP/following{/other_user}","gists_url":"https://api.github.com/users/CanalTP/gists{/gist_id}","starred_url":"https://api.github.com/users/CanalTP/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/CanalTP/subscriptions","organizations_url":"https://api.github.com/users/CanalTP/orgs","repos_url":"https://api.github.com/users/CanalTP/repos","events_url":"https://api.github.com/users/CanalTP/events{/privacy}","received_events_url":"https://api.github.com/users/CanalTP/received_events","type":"Organization","site_admin":false},"repo":{"id":10797333,"name":"navitia","full_name":"CanalTP/navitia","owner":{"login":"CanalTP","id":2743985,"avatar_url":"https://avatars.githubusercontent.com/u/2743985?v=3","gravatar_id":"","url":"https://api.github.com/users/CanalTP","html_url":"https://github.com/CanalTP","followers_url":"https://api.github.com/users/CanalTP/followers","following_url":"https://api.github.com/users/CanalTP/following{/other_user}","gists_url":"https://api.github.com/users/CanalTP/gists{/gist_id}","starred_url":"https://api.github.com/users/CanalTP/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/CanalTP/subscriptions","organizations_url":"https://api.github.com/users/CanalTP/orgs","repos_url":"https://api.github.com/users/CanalTP/repos","events_url":"https://api.github.com/users/CanalTP/events{/privacy}","received_events_url":"https://api.github.com/users/CanalTP/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/CanalTP/navitia","description":"The open source software to build cool stuff with locomotion","fork":false,"url":"https://api.github.com/repos/CanalTP/navitia","forks_url":"https://api.github.com/repos/CanalTP/navitia/forks","keys_url":"https://api.github.com/repos/CanalTP/navitia/keys{/key_id}","collaborators_url":"https://api.github.com/repos/CanalTP/navitia/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/CanalTP/navitia/teams","hooks_url":"https://api.github.com/repos/CanalTP/navitia/hooks","issue_events_url":"https://api.github.com/repos/CanalTP/navitia/issues/events{/number}","events_url":"https://api.github.com/repos/CanalTP/navitia/events","assignees_url":"https://api.github.com/repos/CanalTP/navitia/assignees{/user}","branches_url":"https://api.github.com/repos/CanalTP/navitia/branches{/branch}","tags_url":"https://api.github.com/repos/CanalTP/navitia/tags","blobs_url":"https://api.github.com/repos/CanalTP/navitia/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/CanalTP/navitia/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/CanalTP/navitia/git/refs{/sha}","trees_url":"https://api.github.com/repos/CanalTP/navitia/git/trees{/sha}","statuses_url":"https://api.github.com/repos/CanalTP/navitia/statuses/{sha}","languages_url":"https://api.github.com/repos/CanalTP/navitia/languages","stargazers_url":"https://api.github.com/repos/CanalTP/navitia/stargazers","contributors_url":"https://api.github.com/repos/CanalTP/navitia/contributors","subscribers_url":"https://api.github.com/repos/CanalTP/navitia/subscribers","subscription_url":"https://api.github.com/repos/CanalTP/navitia/subscription","commits_url":"https://api.github.com/repos/CanalTP/navitia/commits{/sha}","git_commits_url":"https://api.github.com/repos/CanalTP/navitia/git/commits{/sha}","comments_url":"https://api.github.com/repos/CanalTP/navitia/comments{/number}","issue_comment_url":"https://api.github.com/repos/CanalTP/navitia/issues/comments{/number}","contents_url":"https://api.github.com/repos/CanalTP/navitia/contents/{+path}","compare_url":"https://api.github.com/repos/CanalTP/navitia/compare/{base}...{head}","merges_url":"https://api.github.com/repos/CanalTP/navitia/merges","archive_url":"https://api.github.com/repos/CanalTP/navitia/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/CanalTP/navitia/downloads","issues_url":"https://api.github.com/repos/CanalTP/navitia/issues{/number}","pulls_url":"https://api.github.com/repos/CanalTP/navitia/pulls{/number}","milestones_url":"https://api.github.com/repos/CanalTP/navitia/milestones{/number}","notifications_url":"https://api.github.com/repos/CanalTP/navitia/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/CanalTP/navitia/labels{/name}","releases_url":"https://api.github.com/repos/CanalTP/navitia/releases{/id}","deployments_url":"https://api.github.com/repos/CanalTP/navitia/deployments","created_at":"2013-06-19T15:34:30Z","updated_at":"2016-10-12T09:01:40Z","pushed_at":"2016-10-13T07:20:55Z","git_url":"git://github.com/CanalTP/navitia.git","ssh_url":"git@github.com:CanalTP/navitia.git","clone_url":"https://github.com/CanalTP/navitia.git","svn_url":"https://github.com/CanalTP/navitia","homepage":"http://www.navitia.io","size":39424,"stargazers_count":183,"watchers_count":183,"language":"C++","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":65,"mirror_url":null,"open_issues_count":26,"forks":65,"open_issues":26,"watchers":183,"default_branch":"dev"}},"_links":{"self":{"href":"https://api.github.com/repos/CanalTP/navitia/pulls/1825"},"html":{"href":"https://github.com/CanalTP/navitia/pull/1825"},"issue":{"href":"https://api.github.com/repos/CanalTP/navitia/issues/1825"},"comments":{"href":"https://api.github.com/repos/CanalTP/navitia/issues/1825/comments"},"review_comments":{"href":"https://api.github.com/repos/CanalTP/navitia/pulls/1825/comments"},"review_comment":{"href":"https://api.github.com/repos/CanalTP/navitia/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/CanalTP/navitia/pulls/1825/commits"},"statuses":{"href":"https://api.github.com/repos/CanalTP/navitia/statuses/958e581c2edb6bb5a694a6328407baf8487f671f"}}}}
{"actor":{"display_login":"pbougue"}}