{"action":"created","comment":{"url":"https://api.github.com/repos/commercetools/commercetools-node-variant-reassignment/pulls/comments/210322065","pull_request_review_id":146051237,"id":210322065,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIxMDMyMjA2NQ==","diff_hunk":"@@ -132,47 +171,53 @@ export default class VariantReassignment {\n           transactionObject\n         )\n         await this.transactionService.deleteTransaction(key)\n-      } catch (e) {\n-        this.logger.error('Could not process unfinished transaction', e)\n-        throw e\n       }\n+    } catch (e) {\n+      if (retryCount < constants.MAX_RETRIES && !this._isUnrecoverableError(e))\n+        await this._handleUnfinishedTransactionsError(retryCount)\n+      else\n+        throw e\n     }\n   }\n \n-  async _processProductDraft (productDraft, products) {\n-    this.logger.debug(\n-      'Processing reassignment for productDraft with name %j',\n-      productDraft.name\n-    )\n-\n-    const matchingProducts = await this._selectMatchingProducts(productDraft, products)\n+  async _processProductDraft (productDraft, products, retryCount = 0) {\n+    try {\n+      log(\n+        `Processing reassignment for productDraft with name ${JSON.stringify(productDraft.name)}`\n+      )\n \n-    if (matchingProducts.length === 0)\n-      return\n+      const matchingProducts = await this._selectMatchingProducts(productDraft, products)\n \n-    // select using SLUG, etc..\n-    const ctpProductToUpdate = this._selectCtpProductToUpdate(productDraft, matchingProducts)\n-    this.logger.debug('Selected ctpProductToUpdate with id \"%s\"', ctpProductToUpdate.id)\n+      if (matchingProducts.length === 0)","path":"lib/runner/variant-reassignment.js","position":242,"original_position":242,"commit_id":"4959eedd83a0f1cee1f09effc458f43042e5d637","original_commit_id":"4959eedd83a0f1cee1f09effc458f43042e5d637","user":{"login":"junajan","id":1090382,"node_id":"MDQ6VXNlcjEwOTAzODI=","avatar_url":"https://avatars0.githubusercontent.com/u/1090382?v=4","gravatar_id":"","url":"https://api.github.com/users/junajan","html_url":"https://github.com/junajan","followers_url":"https://api.github.com/users/junajan/followers","following_url":"https://api.github.com/users/junajan/following{/other_user}","gists_url":"https://api.github.com/users/junajan/gists{/gist_id}","starred_url":"https://api.github.com/users/junajan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/junajan/subscriptions","organizations_url":"https://api.github.com/users/junajan/orgs","repos_url":"https://api.github.com/users/junajan/repos","events_url":"https://api.github.com/users/junajan/events{/privacy}","received_events_url":"https://api.github.com/users/junajan/received_events","type":"User","site_admin":false},"body":"this should be a redundant check right? because we filter out products which do not have any matching products at the beginning.","created_at":"2018-08-15T16:11:42Z","updated_at":"2018-08-15T16:12:33Z","html_url":"https://github.com/commercetools/commercetools-node-variant-reassignment/pull/48#discussion_r210322065","pull_request_url":"https://api.github.com/repos/commercetools/commercetools-node-variant-reassignment/pulls/48","author_association":"COLLABORATOR","_links":{"self":{"href":"https://api.github.com/repos/commercetools/commercetools-node-variant-reassignment/pulls/comments/210322065"},"html":{"href":"https://github.com/commercetools/commercetools-node-variant-reassignment/pull/48#discussion_r210322065"},"pull_request":{"href":"https://api.github.com/repos/commercetools/commercetools-node-variant-reassignment/pulls/48"}}},"pull_request":{"url":"https://api.github.com/repos/commercetools/commercetools-node-variant-reassignment/pulls/48","id":163992673,"node_id":"MDExOlB1bGxSZXF1ZXN0MTYzOTkyNjcz","html_url":"https://github.com/commercetools/commercetools-node-variant-reassignment/pull/48","diff_url":"https://github.com/commercetools/commercetools-node-variant-reassignment/pull/48.diff","patch_url":"https://github.com/commercetools/commercetools-node-variant-reassignment/pull/48.patch","issue_url":"https://api.github.com/repos/commercetools/commercetools-node-variant-reassignment/issues/48","number":48,"state":"open","locked":false,"title":"#2 finalize the module","user":{"login":"lojzatran","id":803826,"node_id":"MDQ6VXNlcjgwMzgyNg==","avatar_url":"https://avatars0.githubusercontent.com/u/803826?v=4","gravatar_id":"","url":"https://api.github.com/users/lojzatran","html_url":"https://github.com/lojzatran","followers_url":"https://api.github.com/users/lojzatran/followers","following_url":"https://api.github.com/users/lojzatran/following{/other_user}","gists_url":"https://api.github.com/users/lojzatran/gists{/gist_id}","starred_url":"https://api.github.com/users/lojzatran/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lojzatran/subscriptions","organizations_url":"https://api.github.com/users/lojzatran/orgs","repos_url":"https://api.github.com/users/lojzatran/repos","events_url":"https://api.github.com/users/lojzatran/events{/privacy}","received_events_url":"https://api.github.com/users/lojzatran/received_events","type":"User","site_admin":false},"body":"What was done:\r\n\r\n1) Add statistics\r\n2) Add error logging and callbacks\r\n3) Retry mechanism\r\n4) Other bug fixes discovered during testing phase","created_at":"2018-01-19T15:10:52Z","updated_at":"2018-08-15T16:12:33Z","closed_at":null,"merged_at":null,"merge_commit_sha":"f34d4d5905871d81746c453a75debc2071eaa261","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[{"id":763078864,"node_id":"MDU6TGFiZWw3NjMwNzg4NjQ=","url":"https://api.github.com/repos/commercetools/commercetools-node-variant-reassignment/labels/in%20progress","name":"in progress","color":"fced8d","default":false}],"milestone":null,"commits_url":"https://api.github.com/repos/commercetools/commercetools-node-variant-reassignment/pulls/48/commits","review_comments_url":"https://api.github.com/repos/commercetools/commercetools-node-variant-reassignment/pulls/48/comments","review_comment_url":"https://api.github.com/repos/commercetools/commercetools-node-variant-reassignment/pulls/comments{/number}","comments_url":"https://api.github.com/repos/commercetools/commercetools-node-variant-reassignment/issues/48/comments","statuses_url":"https://api.github.com/repos/commercetools/commercetools-node-variant-reassignment/statuses/4959eedd83a0f1cee1f09effc458f43042e5d637","head":{"label":"commercetools:2-integrate-to-product-import","ref":"2-integrate-to-product-import","sha":"4959eedd83a0f1cee1f09effc458f43042e5d637","user":{"login":"commercetools","id":1084585,"node_id":"MDEyOk9yZ2FuaXphdGlvbjEwODQ1ODU=","avatar_url":"https://avatars3.githubusercontent.com/u/1084585?v=4","gravatar_id":"","url":"https://api.github.com/users/commercetools","html_url":"https://github.com/commercetools","followers_url":"https://api.github.com/users/commercetools/followers","following_url":"https://api.github.com/users/commercetools/following{/other_user}","gists_url":"https://api.github.com/users/commercetools/gists{/gist_id}","starred_url":"https://api.github.com/users/commercetools/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/commercetools/subscriptions","organizations_url":"https://api.github.com/users/commercetools/orgs","repos_url":"https://api.github.com/users/commercetools/repos","events_url":"https://api.github.com/users/commercetools/events{/privacy}","received_events_url":"https://api.github.com/users/commercetools/received_events","type":"Organization","site_admin":false},"repo":{"id":110249632,"node_id":"MDEwOlJlcG9zaXRvcnkxMTAyNDk2MzI=","name":"commercetools-node-variant-reassignment","full_name":"commercetools/commercetools-node-variant-reassignment","owner":{"login":"commercetools","id":1084585,"node_id":"MDEyOk9yZ2FuaXphdGlvbjEwODQ1ODU=","avatar_url":"https://avatars3.githubusercontent.com/u/1084585?v=4","gravatar_id":"","url":"https://api.github.com/users/commercetools","html_url":"https://github.com/commercetools","followers_url":"https://api.github.com/users/commercetools/followers","following_url":"https://api.github.com/users/commercetools/following{/other_user}","gists_url":"https://api.github.com/users/commercetools/gists{/gist_id}","starred_url":"https://api.github.com/users/commercetools/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/commercetools/subscriptions","organizations_url":"https://api.github.com/users/commercetools/orgs","repos_url":"https://api.github.com/users/commercetools/repos","events_url":"https://api.github.com/users/commercetools/events{/privacy}","received_events_url":"https://api.github.com/users/commercetools/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/commercetools/commercetools-node-variant-reassignment","description":"Node.js utility which complements product sync/import process by automatic conflicts resolution and reassignment of variants from one product to another","fork":false,"url":"https://api.github.com/repos/commercetools/commercetools-node-variant-reassignment","forks_url":"https://api.github.com/repos/commercetools/commercetools-node-variant-reassignment/forks","keys_url":"https://api.github.com/repos/commercetools/commercetools-node-variant-reassignment/keys{/key_id}","collaborators_url":"https://api.github.com/repos/commercetools/commercetools-node-variant-reassignment/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/commercetools/commercetools-node-variant-reassignment/teams","hooks_url":"https://api.github.com/repos/commercetools/commercetools-node-variant-reassignment/hooks","issue_events_url":"https://api.github.com/repos/commercetools/commercetools-node-variant-reassignment/issues/events{/number}","events_url":"https://api.github.com/repos/commercetools/commercetools-node-variant-reassignment/events","assignees_url":"https://api.github.com/repos/commercetools/commercetools-node-variant-reassignment/assignees{/user}","branches_url":"https://api.github.com/repos/commercetools/commercetools-node-variant-reassignment/branches{/branch}","tags_url":"https://api.github.com/repos/commercetools/commercetools-node-variant-reassignment/tags","blobs_url":"https://api.github.com/repos/commercetools/commercetools-node-variant-reassignment/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/commercetools/commercetools-node-variant-reassignment/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/commercetools/commercetools-node-variant-reassignment/git/refs{/sha}","trees_url":"https://api.github.com/repos/commercetools/commercetools-node-variant-reassignment/git/trees{/sha}","statuses_url":"https://api.github.com/repos/commercetools/commercetools-node-variant-reassignment/statuses/{sha}","languages_url":"https://api.github.com/repos/commercetools/commercetools-node-variant-reassignment/languages","stargazers_url":"https://api.github.com/repos/commercetools/commercetools-node-variant-reassignment/stargazers","contributors_url":"https://api.github.com/repos/commercetools/commercetools-node-variant-reassignment/contributors","subscribers_url":"https://api.github.com/repos/commercetools/commercetools-node-variant-reassignment/subscribers","subscription_url":"https://api.github.com/repos/commercetools/commercetools-node-variant-reassignment/subscription","commits_url":"https://api.github.com/repos/commercetools/commercetools-node-variant-reassignment/commits{/sha}","git_commits_url":"https://api.github.com/repos/commercetools/commercetools-node-variant-reassignment/git/commits{/sha}","comments_url":"https://api.github.com/repos/commercetools/commercetools-node-variant-reassignment/comments{/number}","issue_comment_url":"https://api.github.com/repos/commercetools/commercetools-node-variant-reassignment/issues/comments{/number}","contents_url":"https://api.github.com/repos/commercetools/commercetools-node-variant-reassignment/contents/{+path}","compare_url":"https://api.github.com/repos/commercetools/commercetools-node-variant-reassignment/compare/{base}...{head}","merges_url":"https://api.github.com/repos/commercetools/commercetools-node-variant-reassignment/merges","archive_url":"https://api.github.com/repos/commercetools/commercetools-node-variant-reassignment/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/commercetools/commercetools-node-variant-reassignment/downloads","issues_url":"https://api.github.com/repos/commercetools/commercetools-node-variant-reassignment/issues{/number}","pulls_url":"https://api.github.com/repos/commercetools/commercetools-node-variant-reassignment/pulls{/number}","milestones_url":"https://api.github.com/repos/commercetools/commercetools-node-variant-reassignment/milestones{/number}","notifications_url":"https://api.github.com/repos/commercetools/commercetools-node-variant-reassignment/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/commercetools/commercetools-node-variant-reassignment/labels{/name}","releases_url":"https://api.github.com/repos/commercetools/commercetools-node-variant-reassignment/releases{/id}","deployments_url":"https://api.github.com/repos/commercetools/commercetools-node-variant-reassignment/deployments","created_at":"2017-11-10T13:25:20Z","updated_at":"2018-06-04T08:22:31Z","pushed_at":"2018-08-14T11:45:42Z","git_url":"git://github.com/commercetools/commercetools-node-variant-reassignment.git","ssh_url":"git@github.com:commercetools/commercetools-node-variant-reassignment.git","clone_url":"https://github.com/commercetools/commercetools-node-variant-reassignment.git","svn_url":"https://github.com/commercetools/commercetools-node-variant-reassignment","homepage":null,"size":503,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":18,"license":null,"forks":0,"open_issues":18,"watchers":0,"default_branch":"master"}},"base":{"label":"commercetools:master","ref":"master","sha":"469bb13dc1edf91521f4c5696054105690df3c50","user":{"login":"commercetools","id":1084585,"node_id":"MDEyOk9yZ2FuaXphdGlvbjEwODQ1ODU=","avatar_url":"https://avatars3.githubusercontent.com/u/1084585?v=4","gravatar_id":"","url":"https://api.github.com/users/commercetools","html_url":"https://github.com/commercetools","followers_url":"https://api.github.com/users/commercetools/followers","following_url":"https://api.github.com/users/commercetools/following{/other_user}","gists_url":"https://api.github.com/users/commercetools/gists{/gist_id}","starred_url":"https://api.github.com/users/commercetools/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/commercetools/subscriptions","organizations_url":"https://api.github.com/users/commercetools/orgs","repos_url":"https://api.github.com/users/commercetools/repos","events_url":"https://api.github.com/users/commercetools/events{/privacy}","received_events_url":"https://api.github.com/users/commercetools/received_events","type":"Organization","site_admin":false},"repo":{"id":110249632,"node_id":"MDEwOlJlcG9zaXRvcnkxMTAyNDk2MzI=","name":"commercetools-node-variant-reassignment","full_name":"commercetools/commercetools-node-variant-reassignment","owner":{"login":"commercetools","id":1084585,"node_id":"MDEyOk9yZ2FuaXphdGlvbjEwODQ1ODU=","avatar_url":"https://avatars3.githubusercontent.com/u/1084585?v=4","gravatar_id":"","url":"https://api.github.com/users/commercetools","html_url":"https://github.com/commercetools","followers_url":"https://api.github.com/users/commercetools/followers","following_url":"https://api.github.com/users/commercetools/following{/other_user}","gists_url":"https://api.github.com/users/commercetools/gists{/gist_id}","starred_url":"https://api.github.com/users/commercetools/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/commercetools/subscriptions","organizations_url":"https://api.github.com/users/commercetools/orgs","repos_url":"https://api.github.com/users/commercetools/repos","events_url":"https://api.github.com/users/commercetools/events{/privacy}","received_events_url":"https://api.github.com/users/commercetools/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/commercetools/commercetools-node-variant-reassignment","description":"Node.js utility which complements product sync/import process by automatic conflicts resolution and reassignment of variants from one product to another","fork":false,"url":"https://api.github.com/repos/commercetools/commercetools-node-variant-reassignment","forks_url":"https://api.github.com/repos/commercetools/commercetools-node-variant-reassignment/forks","keys_url":"https://api.github.com/repos/commercetools/commercetools-node-variant-reassignment/keys{/key_id}","collaborators_url":"https://api.github.com/repos/commercetools/commercetools-node-variant-reassignment/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/commercetools/commercetools-node-variant-reassignment/teams","hooks_url":"https://api.github.com/repos/commercetools/commercetools-node-variant-reassignment/hooks","issue_events_url":"https://api.github.com/repos/commercetools/commercetools-node-variant-reassignment/issues/events{/number}","events_url":"https://api.github.com/repos/commercetools/commercetools-node-variant-reassignment/events","assignees_url":"https://api.github.com/repos/commercetools/commercetools-node-variant-reassignment/assignees{/user}","branches_url":"https://api.github.com/repos/commercetools/commercetools-node-variant-reassignment/branches{/branch}","tags_url":"https://api.github.com/repos/commercetools/commercetools-node-variant-reassignment/tags","blobs_url":"https://api.github.com/repos/commercetools/commercetools-node-variant-reassignment/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/commercetools/commercetools-node-variant-reassignment/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/commercetools/commercetools-node-variant-reassignment/git/refs{/sha}","trees_url":"https://api.github.com/repos/commercetools/commercetools-node-variant-reassignment/git/trees{/sha}","statuses_url":"https://api.github.com/repos/commercetools/commercetools-node-variant-reassignment/statuses/{sha}","languages_url":"https://api.github.com/repos/commercetools/commercetools-node-variant-reassignment/languages","stargazers_url":"https://api.github.com/repos/commercetools/commercetools-node-variant-reassignment/stargazers","contributors_url":"https://api.github.com/repos/commercetools/commercetools-node-variant-reassignment/contributors","subscribers_url":"https://api.github.com/repos/commercetools/commercetools-node-variant-reassignment/subscribers","subscription_url":"https://api.github.com/repos/commercetools/commercetools-node-variant-reassignment/subscription","commits_url":"https://api.github.com/repos/commercetools/commercetools-node-variant-reassignment/commits{/sha}","git_commits_url":"https://api.github.com/repos/commercetools/commercetools-node-variant-reassignment/git/commits{/sha}","comments_url":"https://api.github.com/repos/commercetools/commercetools-node-variant-reassignment/comments{/number}","issue_comment_url":"https://api.github.com/repos/commercetools/commercetools-node-variant-reassignment/issues/comments{/number}","contents_url":"https://api.github.com/repos/commercetools/commercetools-node-variant-reassignment/contents/{+path}","compare_url":"https://api.github.com/repos/commercetools/commercetools-node-variant-reassignment/compare/{base}...{head}","merges_url":"https://api.github.com/repos/commercetools/commercetools-node-variant-reassignment/merges","archive_url":"https://api.github.com/repos/commercetools/commercetools-node-variant-reassignment/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/commercetools/commercetools-node-variant-reassignment/downloads","issues_url":"https://api.github.com/repos/commercetools/commercetools-node-variant-reassignment/issues{/number}","pulls_url":"https://api.github.com/repos/commercetools/commercetools-node-variant-reassignment/pulls{/number}","milestones_url":"https://api.github.com/repos/commercetools/commercetools-node-variant-reassignment/milestones{/number}","notifications_url":"https://api.github.com/repos/commercetools/commercetools-node-variant-reassignment/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/commercetools/commercetools-node-variant-reassignment/labels{/name}","releases_url":"https://api.github.com/repos/commercetools/commercetools-node-variant-reassignment/releases{/id}","deployments_url":"https://api.github.com/repos/commercetools/commercetools-node-variant-reassignment/deployments","created_at":"2017-11-10T13:25:20Z","updated_at":"2018-06-04T08:22:31Z","pushed_at":"2018-08-14T11:45:42Z","git_url":"git://github.com/commercetools/commercetools-node-variant-reassignment.git","ssh_url":"git@github.com:commercetools/commercetools-node-variant-reassignment.git","clone_url":"https://github.com/commercetools/commercetools-node-variant-reassignment.git","svn_url":"https://github.com/commercetools/commercetools-node-variant-reassignment","homepage":null,"size":503,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":18,"license":null,"forks":0,"open_issues":18,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/commercetools/commercetools-node-variant-reassignment/pulls/48"},"html":{"href":"https://github.com/commercetools/commercetools-node-variant-reassignment/pull/48"},"issue":{"href":"https://api.github.com/repos/commercetools/commercetools-node-variant-reassignment/issues/48"},"comments":{"href":"https://api.github.com/repos/commercetools/commercetools-node-variant-reassignment/issues/48/comments"},"review_comments":{"href":"https://api.github.com/repos/commercetools/commercetools-node-variant-reassignment/pulls/48/comments"},"review_comment":{"href":"https://api.github.com/repos/commercetools/commercetools-node-variant-reassignment/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/commercetools/commercetools-node-variant-reassignment/pulls/48/commits"},"statuses":{"href":"https://api.github.com/repos/commercetools/commercetools-node-variant-reassignment/statuses/4959eedd83a0f1cee1f09effc458f43042e5d637"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"junajan"}}