{"action":"created","comment":{"url":"https://api.github.com/repos/DIRACGrid/DIRAC/pulls/comments/48876050","id":48876050,"diff_hunk":"@@ -69,29 +72,53 @@ def __getRPCClient( self ):\n       return RPCClient( \"Accounting/DataStore\", setup = self.__setup, timeout = 3600 )\n     return RPCClient( \"Accounting/DataStore\", timeout = 3600 )\n \n-  @gAccountingSynchro\n   def commit( self ):\n     \"\"\"\n     Send the registers in a bundle mode\n     \"\"\"\n     rpcClient = self.__getRPCClient()\n     sent = 0\n-    while len( self.__registersList ) > 0:\n-      registersToSend = self.__registersList[ :self.__maxRecordsInABundle ]\n-      retVal = rpcClient.commitRegisters( registersToSend )\n-      if retVal[ 'OK' ]:\n-        self.__lastSuccessfulCommit = time.time()\n-      else:\n-        if self.__failoverEnabled and time.time() - self.__lastSuccessfulCommit > self.__maxTimeRetrying:\n-          gLogger.verbose( \"Sending accounting records to failover\" )\n-          result = _sendToFailover( retVal[ 'rpcStub' ] )\n-          if not result[ 'OK' ]:\n-            return result\n+    \n+    # create a local reference and prevent other running commits\n+    # to take the same data second time \n+    self.__registersListLock.acquire()\n+    registersList = self.__registersList\n+    self.__registersList = []\n+    self.__registersListLock.release()\n+    \n+    try:\n+      while len( registersList ) > 0:","path":"AccountingSystem/Client/DataStoreClient.py","position":81,"original_position":81,"commit_id":"bc28487b69e1ace7f8ad186a73f49061f20ed804","original_commit_id":"bc28487b69e1ace7f8ad186a73f49061f20ed804","user":{"login":"hgiemza","id":12168942,"avatar_url":"https://avatars.githubusercontent.com/u/12168942?v=3","gravatar_id":"","url":"https://api.github.com/users/hgiemza","html_url":"https://github.com/hgiemza","followers_url":"https://api.github.com/users/hgiemza/followers","following_url":"https://api.github.com/users/hgiemza/following{/other_user}","gists_url":"https://api.github.com/users/hgiemza/gists{/gist_id}","starred_url":"https://api.github.com/users/hgiemza/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hgiemza/subscriptions","organizations_url":"https://api.github.com/users/hgiemza/orgs","repos_url":"https://api.github.com/users/hgiemza/repos","events_url":"https://api.github.com/users/hgiemza/events{/privacy}","received_events_url":"https://api.github.com/users/hgiemza/received_events","type":"User","site_admin":false},"body":"Good point I will change.","created_at":"2016-01-05T18:15:23Z","updated_at":"2016-01-05T18:15:23Z","html_url":"https://github.com/DIRACGrid/DIRAC/pull/2751#discussion_r48876050","pull_request_url":"https://api.github.com/repos/DIRACGrid/DIRAC/pulls/2751","_links":{"self":{"href":"https://api.github.com/repos/DIRACGrid/DIRAC/pulls/comments/48876050"},"html":{"href":"https://github.com/DIRACGrid/DIRAC/pull/2751#discussion_r48876050"},"pull_request":{"href":"https://api.github.com/repos/DIRACGrid/DIRAC/pulls/2751"}}},"pull_request":{"url":"https://api.github.com/repos/DIRACGrid/DIRAC/pulls/2751","id":54004906,"html_url":"https://github.com/DIRACGrid/DIRAC/pull/2751","diff_url":"https://github.com/DIRACGrid/DIRAC/pull/2751.diff","patch_url":"https://github.com/DIRACGrid/DIRAC/pull/2751.patch","issue_url":"https://api.github.com/repos/DIRACGrid/DIRAC/issues/2751","number":2751,"state":"open","locked":false,"title":"[v6r15] Performance update in DataStoreClient","user":{"login":"hgiemza","id":12168942,"avatar_url":"https://avatars.githubusercontent.com/u/12168942?v=3","gravatar_id":"","url":"https://api.github.com/users/hgiemza","html_url":"https://github.com/hgiemza","followers_url":"https://api.github.com/users/hgiemza/followers","following_url":"https://api.github.com/users/hgiemza/following{/other_user}","gists_url":"https://api.github.com/users/hgiemza/gists{/gist_id}","starred_url":"https://api.github.com/users/hgiemza/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hgiemza/subscriptions","organizations_url":"https://api.github.com/users/hgiemza/orgs","repos_url":"https://api.github.com/users/hgiemza/repos","events_url":"https://api.github.com/users/hgiemza/events{/privacy}","received_events_url":"https://api.github.com/users/hgiemza/received_events","type":"User","site_admin":false},"body":"* Synchronizer based decorators have been replaced with a simple lock as they were blocking addRegister() during every commit() (and commits could take several seconds to finish)\r\n* Added delayedCommit() which reduces overheads. Call to this function will in the future be propagated to BaseAccountingType class and similar places\r\n* See comment in the lines 59-60\r\n* Change of the target branch (see pull request #2747)","created_at":"2015-12-17T17:17:23Z","updated_at":"2016-01-05T18:15:23Z","closed_at":null,"merged_at":null,"merge_commit_sha":"b1246f1d7be0615e5314bddcabfbf2b90dd394c3","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/DIRACGrid/DIRAC/pulls/2751/commits","review_comments_url":"https://api.github.com/repos/DIRACGrid/DIRAC/pulls/2751/comments","review_comment_url":"https://api.github.com/repos/DIRACGrid/DIRAC/pulls/comments{/number}","comments_url":"https://api.github.com/repos/DIRACGrid/DIRAC/issues/2751/comments","statuses_url":"https://api.github.com/repos/DIRACGrid/DIRAC/statuses/bc28487b69e1ace7f8ad186a73f49061f20ed804","head":{"label":"hgiemza:perfupdate","ref":"perfupdate","sha":"bc28487b69e1ace7f8ad186a73f49061f20ed804","user":{"login":"hgiemza","id":12168942,"avatar_url":"https://avatars.githubusercontent.com/u/12168942?v=3","gravatar_id":"","url":"https://api.github.com/users/hgiemza","html_url":"https://github.com/hgiemza","followers_url":"https://api.github.com/users/hgiemza/followers","following_url":"https://api.github.com/users/hgiemza/following{/other_user}","gists_url":"https://api.github.com/users/hgiemza/gists{/gist_id}","starred_url":"https://api.github.com/users/hgiemza/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hgiemza/subscriptions","organizations_url":"https://api.github.com/users/hgiemza/orgs","repos_url":"https://api.github.com/users/hgiemza/repos","events_url":"https://api.github.com/users/hgiemza/events{/privacy}","received_events_url":"https://api.github.com/users/hgiemza/received_events","type":"User","site_admin":false},"repo":{"id":39996540,"name":"DIRAC","full_name":"hgiemza/DIRAC","owner":{"login":"hgiemza","id":12168942,"avatar_url":"https://avatars.githubusercontent.com/u/12168942?v=3","gravatar_id":"","url":"https://api.github.com/users/hgiemza","html_url":"https://github.com/hgiemza","followers_url":"https://api.github.com/users/hgiemza/followers","following_url":"https://api.github.com/users/hgiemza/following{/other_user}","gists_url":"https://api.github.com/users/hgiemza/gists{/gist_id}","starred_url":"https://api.github.com/users/hgiemza/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hgiemza/subscriptions","organizations_url":"https://api.github.com/users/hgiemza/orgs","repos_url":"https://api.github.com/users/hgiemza/repos","events_url":"https://api.github.com/users/hgiemza/events{/privacy}","received_events_url":"https://api.github.com/users/hgiemza/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/hgiemza/DIRAC","description":"DIRAC Grid","fork":true,"url":"https://api.github.com/repos/hgiemza/DIRAC","forks_url":"https://api.github.com/repos/hgiemza/DIRAC/forks","keys_url":"https://api.github.com/repos/hgiemza/DIRAC/keys{/key_id}","collaborators_url":"https://api.github.com/repos/hgiemza/DIRAC/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/hgiemza/DIRAC/teams","hooks_url":"https://api.github.com/repos/hgiemza/DIRAC/hooks","issue_events_url":"https://api.github.com/repos/hgiemza/DIRAC/issues/events{/number}","events_url":"https://api.github.com/repos/hgiemza/DIRAC/events","assignees_url":"https://api.github.com/repos/hgiemza/DIRAC/assignees{/user}","branches_url":"https://api.github.com/repos/hgiemza/DIRAC/branches{/branch}","tags_url":"https://api.github.com/repos/hgiemza/DIRAC/tags","blobs_url":"https://api.github.com/repos/hgiemza/DIRAC/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/hgiemza/DIRAC/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/hgiemza/DIRAC/git/refs{/sha}","trees_url":"https://api.github.com/repos/hgiemza/DIRAC/git/trees{/sha}","statuses_url":"https://api.github.com/repos/hgiemza/DIRAC/statuses/{sha}","languages_url":"https://api.github.com/repos/hgiemza/DIRAC/languages","stargazers_url":"https://api.github.com/repos/hgiemza/DIRAC/stargazers","contributors_url":"https://api.github.com/repos/hgiemza/DIRAC/contributors","subscribers_url":"https://api.github.com/repos/hgiemza/DIRAC/subscribers","subscription_url":"https://api.github.com/repos/hgiemza/DIRAC/subscription","commits_url":"https://api.github.com/repos/hgiemza/DIRAC/commits{/sha}","git_commits_url":"https://api.github.com/repos/hgiemza/DIRAC/git/commits{/sha}","comments_url":"https://api.github.com/repos/hgiemza/DIRAC/comments{/number}","issue_comment_url":"https://api.github.com/repos/hgiemza/DIRAC/issues/comments{/number}","contents_url":"https://api.github.com/repos/hgiemza/DIRAC/contents/{+path}","compare_url":"https://api.github.com/repos/hgiemza/DIRAC/compare/{base}...{head}","merges_url":"https://api.github.com/repos/hgiemza/DIRAC/merges","archive_url":"https://api.github.com/repos/hgiemza/DIRAC/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/hgiemza/DIRAC/downloads","issues_url":"https://api.github.com/repos/hgiemza/DIRAC/issues{/number}","pulls_url":"https://api.github.com/repos/hgiemza/DIRAC/pulls{/number}","milestones_url":"https://api.github.com/repos/hgiemza/DIRAC/milestones{/number}","notifications_url":"https://api.github.com/repos/hgiemza/DIRAC/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/hgiemza/DIRAC/labels{/name}","releases_url":"https://api.github.com/repos/hgiemza/DIRAC/releases{/id}","created_at":"2015-07-31T08:59:53Z","updated_at":"2015-07-31T08:59:57Z","pushed_at":"2015-12-15T13:53:19Z","git_url":"git://github.com/hgiemza/DIRAC.git","ssh_url":"git@github.com:hgiemza/DIRAC.git","clone_url":"https://github.com/hgiemza/DIRAC.git","svn_url":"https://github.com/hgiemza/DIRAC","homepage":"http://diracgrid.org","size":29102,"stargazers_count":0,"watchers_count":0,"language":"Python","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":"integration"}},"base":{"label":"DIRACGrid:rel-v6r15","ref":"rel-v6r15","sha":"1d894fa86cd20221046c9660664755b0ea82258d","user":{"login":"DIRACGrid","id":694842,"avatar_url":"https://avatars.githubusercontent.com/u/694842?v=3","gravatar_id":"","url":"https://api.github.com/users/DIRACGrid","html_url":"https://github.com/DIRACGrid","followers_url":"https://api.github.com/users/DIRACGrid/followers","following_url":"https://api.github.com/users/DIRACGrid/following{/other_user}","gists_url":"https://api.github.com/users/DIRACGrid/gists{/gist_id}","starred_url":"https://api.github.com/users/DIRACGrid/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DIRACGrid/subscriptions","organizations_url":"https://api.github.com/users/DIRACGrid/orgs","repos_url":"https://api.github.com/users/DIRACGrid/repos","events_url":"https://api.github.com/users/DIRACGrid/events{/privacy}","received_events_url":"https://api.github.com/users/DIRACGrid/received_events","type":"Organization","site_admin":false},"repo":{"id":1576831,"name":"DIRAC","full_name":"DIRACGrid/DIRAC","owner":{"login":"DIRACGrid","id":694842,"avatar_url":"https://avatars.githubusercontent.com/u/694842?v=3","gravatar_id":"","url":"https://api.github.com/users/DIRACGrid","html_url":"https://github.com/DIRACGrid","followers_url":"https://api.github.com/users/DIRACGrid/followers","following_url":"https://api.github.com/users/DIRACGrid/following{/other_user}","gists_url":"https://api.github.com/users/DIRACGrid/gists{/gist_id}","starred_url":"https://api.github.com/users/DIRACGrid/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DIRACGrid/subscriptions","organizations_url":"https://api.github.com/users/DIRACGrid/orgs","repos_url":"https://api.github.com/users/DIRACGrid/repos","events_url":"https://api.github.com/users/DIRACGrid/events{/privacy}","received_events_url":"https://api.github.com/users/DIRACGrid/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/DIRACGrid/DIRAC","description":"DIRAC Grid","fork":false,"url":"https://api.github.com/repos/DIRACGrid/DIRAC","forks_url":"https://api.github.com/repos/DIRACGrid/DIRAC/forks","keys_url":"https://api.github.com/repos/DIRACGrid/DIRAC/keys{/key_id}","collaborators_url":"https://api.github.com/repos/DIRACGrid/DIRAC/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/DIRACGrid/DIRAC/teams","hooks_url":"https://api.github.com/repos/DIRACGrid/DIRAC/hooks","issue_events_url":"https://api.github.com/repos/DIRACGrid/DIRAC/issues/events{/number}","events_url":"https://api.github.com/repos/DIRACGrid/DIRAC/events","assignees_url":"https://api.github.com/repos/DIRACGrid/DIRAC/assignees{/user}","branches_url":"https://api.github.com/repos/DIRACGrid/DIRAC/branches{/branch}","tags_url":"https://api.github.com/repos/DIRACGrid/DIRAC/tags","blobs_url":"https://api.github.com/repos/DIRACGrid/DIRAC/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/DIRACGrid/DIRAC/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/DIRACGrid/DIRAC/git/refs{/sha}","trees_url":"https://api.github.com/repos/DIRACGrid/DIRAC/git/trees{/sha}","statuses_url":"https://api.github.com/repos/DIRACGrid/DIRAC/statuses/{sha}","languages_url":"https://api.github.com/repos/DIRACGrid/DIRAC/languages","stargazers_url":"https://api.github.com/repos/DIRACGrid/DIRAC/stargazers","contributors_url":"https://api.github.com/repos/DIRACGrid/DIRAC/contributors","subscribers_url":"https://api.github.com/repos/DIRACGrid/DIRAC/subscribers","subscription_url":"https://api.github.com/repos/DIRACGrid/DIRAC/subscription","commits_url":"https://api.github.com/repos/DIRACGrid/DIRAC/commits{/sha}","git_commits_url":"https://api.github.com/repos/DIRACGrid/DIRAC/git/commits{/sha}","comments_url":"https://api.github.com/repos/DIRACGrid/DIRAC/comments{/number}","issue_comment_url":"https://api.github.com/repos/DIRACGrid/DIRAC/issues/comments{/number}","contents_url":"https://api.github.com/repos/DIRACGrid/DIRAC/contents/{+path}","compare_url":"https://api.github.com/repos/DIRACGrid/DIRAC/compare/{base}...{head}","merges_url":"https://api.github.com/repos/DIRACGrid/DIRAC/merges","archive_url":"https://api.github.com/repos/DIRACGrid/DIRAC/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/DIRACGrid/DIRAC/downloads","issues_url":"https://api.github.com/repos/DIRACGrid/DIRAC/issues{/number}","pulls_url":"https://api.github.com/repos/DIRACGrid/DIRAC/pulls{/number}","milestones_url":"https://api.github.com/repos/DIRACGrid/DIRAC/milestones{/number}","notifications_url":"https://api.github.com/repos/DIRACGrid/DIRAC/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/DIRACGrid/DIRAC/labels{/name}","releases_url":"https://api.github.com/repos/DIRACGrid/DIRAC/releases{/id}","created_at":"2011-04-06T11:47:53Z","updated_at":"2015-11-24T11:00:23Z","pushed_at":"2016-01-05T15:50:52Z","git_url":"git://github.com/DIRACGrid/DIRAC.git","ssh_url":"git@github.com:DIRACGrid/DIRAC.git","clone_url":"https://github.com/DIRACGrid/DIRAC.git","svn_url":"https://github.com/DIRACGrid/DIRAC","homepage":"http://diracgrid.org","size":30834,"stargazers_count":44,"watchers_count":44,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":89,"mirror_url":null,"open_issues_count":120,"forks":89,"open_issues":120,"watchers":44,"default_branch":"integration"}},"_links":{"self":{"href":"https://api.github.com/repos/DIRACGrid/DIRAC/pulls/2751"},"html":{"href":"https://github.com/DIRACGrid/DIRAC/pull/2751"},"issue":{"href":"https://api.github.com/repos/DIRACGrid/DIRAC/issues/2751"},"comments":{"href":"https://api.github.com/repos/DIRACGrid/DIRAC/issues/2751/comments"},"review_comments":{"href":"https://api.github.com/repos/DIRACGrid/DIRAC/pulls/2751/comments"},"review_comment":{"href":"https://api.github.com/repos/DIRACGrid/DIRAC/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/DIRACGrid/DIRAC/pulls/2751/commits"},"statuses":{"href":"https://api.github.com/repos/DIRACGrid/DIRAC/statuses/bc28487b69e1ace7f8ad186a73f49061f20ed804"}}}}