{"action":"created","comment":{"url":"https://api.github.com/repos/Parsimotion/producteca-syncer/pulls/comments/59254656","id":59254656,"diff_hunk":"@@ -0,0 +1,60 @@\n+_ = require \"lodash\"\n+Promise = require \"bluebird\"\n+Queue = include(\"domain/services/queue\")\n+SynchronizationHome = include(\"homes/synchronizationHome\")\n+config = include(\"config/environment\")\n+\n+mongoose = require(\"mongoose\")\n+mongoose.connect config.mongo.uri, config.mongo.options\n+\n+module.exports = \n+  class SynchronizationJob\n+\n+    constructor: (@queueName, {@waitingTime, @timeToUpdateMessage}) ->\n+      @queueClient = Queue.instance()\n+\n+    run: =>\n+      @_createIfNotExists()\n+        .then => @_initNewTask(0)\n+\n+    _initNewTask: (delay) =>\n+      Promise.delay(delay).then => \n+        @_executePendingSynchronizations()\n+\n+      null","path":"App_Data/jobs/continuous/synchronizationJob.coffee","position":24,"original_position":24,"commit_id":"7b2415b7ff1eb4511d60883c476302cb50a1aaed","original_commit_id":"7b2415b7ff1eb4511d60883c476302cb50a1aaed","user":{"login":"rodri042","id":1631752,"avatar_url":"https://avatars.githubusercontent.com/u/1631752?v=3","gravatar_id":"","url":"https://api.github.com/users/rodri042","html_url":"https://github.com/rodri042","followers_url":"https://api.github.com/users/rodri042/followers","following_url":"https://api.github.com/users/rodri042/following{/other_user}","gists_url":"https://api.github.com/users/rodri042/gists{/gist_id}","starred_url":"https://api.github.com/users/rodri042/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rodri042/subscriptions","organizations_url":"https://api.github.com/users/rodri042/orgs","repos_url":"https://api.github.com/users/rodri042/repos","events_url":"https://api.github.com/users/rodri042/events{/privacy}","received_events_url":"https://api.github.com/users/rodri042/received_events","type":"User","site_admin":false},"body":"Podés usar `return` que queda más lindo y nos hace creer que hay menos `null`s (?????)","created_at":"2016-04-11T18:20:26Z","updated_at":"2016-04-11T18:20:26Z","html_url":"https://github.com/Parsimotion/producteca-syncer/pull/21#discussion_r59254656","pull_request_url":"https://api.github.com/repos/Parsimotion/producteca-syncer/pulls/21","_links":{"self":{"href":"https://api.github.com/repos/Parsimotion/producteca-syncer/pulls/comments/59254656"},"html":{"href":"https://github.com/Parsimotion/producteca-syncer/pull/21#discussion_r59254656"},"pull_request":{"href":"https://api.github.com/repos/Parsimotion/producteca-syncer/pulls/21"}}},"pull_request":{"url":"https://api.github.com/repos/Parsimotion/producteca-syncer/pulls/21","id":66031299,"html_url":"https://github.com/Parsimotion/producteca-syncer/pull/21","diff_url":"https://github.com/Parsimotion/producteca-syncer/pull/21.diff","patch_url":"https://github.com/Parsimotion/producteca-syncer/pull/21.patch","issue_url":"https://api.github.com/repos/Parsimotion/producteca-syncer/issues/21","number":21,"state":"open","locked":false,"title":"Feature/queue sync","user":{"login":"gastonprieto","id":770816,"avatar_url":"https://avatars.githubusercontent.com/u/770816?v=3","gravatar_id":"","url":"https://api.github.com/users/gastonprieto","html_url":"https://github.com/gastonprieto","followers_url":"https://api.github.com/users/gastonprieto/followers","following_url":"https://api.github.com/users/gastonprieto/following{/other_user}","gists_url":"https://api.github.com/users/gastonprieto/gists{/gist_id}","starred_url":"https://api.github.com/users/gastonprieto/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gastonprieto/subscriptions","organizations_url":"https://api.github.com/users/gastonprieto/orgs","repos_url":"https://api.github.com/users/gastonprieto/repos","events_url":"https://api.github.com/users/gastonprieto/events{/privacy}","received_events_url":"https://api.github.com/users/gastonprieto/received_events","type":"User","site_admin":false},"body":"[Finishes #116710385](https://www.pivotaltracker.com/story/show/116710385)\r\n\r\nCada vez que se hace un post a ```/synchronizations/:id/run``` se pushea en una queue el id de la sincronización y el usuario.\r\n\r\nLuego un job que esta corriendo saca de 1 a los mensajes y ejecuta la sincronización correspondiente.","created_at":"2016-04-11T17:29:15Z","updated_at":"2016-04-11T18:20:26Z","closed_at":null,"merged_at":null,"merge_commit_sha":"1bbaefc57a8032366e8bdd32b44adfd2f35cf5c6","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/Parsimotion/producteca-syncer/pulls/21/commits","review_comments_url":"https://api.github.com/repos/Parsimotion/producteca-syncer/pulls/21/comments","review_comment_url":"https://api.github.com/repos/Parsimotion/producteca-syncer/pulls/comments{/number}","comments_url":"https://api.github.com/repos/Parsimotion/producteca-syncer/issues/21/comments","statuses_url":"https://api.github.com/repos/Parsimotion/producteca-syncer/statuses/7b2415b7ff1eb4511d60883c476302cb50a1aaed","head":{"label":"Parsimotion:feature/queue-sync","ref":"feature/queue-sync","sha":"7b2415b7ff1eb4511d60883c476302cb50a1aaed","user":{"login":"Parsimotion","id":8582957,"avatar_url":"https://avatars.githubusercontent.com/u/8582957?v=3","gravatar_id":"","url":"https://api.github.com/users/Parsimotion","html_url":"https://github.com/Parsimotion","followers_url":"https://api.github.com/users/Parsimotion/followers","following_url":"https://api.github.com/users/Parsimotion/following{/other_user}","gists_url":"https://api.github.com/users/Parsimotion/gists{/gist_id}","starred_url":"https://api.github.com/users/Parsimotion/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Parsimotion/subscriptions","organizations_url":"https://api.github.com/users/Parsimotion/orgs","repos_url":"https://api.github.com/users/Parsimotion/repos","events_url":"https://api.github.com/users/Parsimotion/events{/privacy}","received_events_url":"https://api.github.com/users/Parsimotion/received_events","type":"Organization","site_admin":false},"repo":{"id":46137398,"name":"producteca-syncer","full_name":"Parsimotion/producteca-syncer","owner":{"login":"Parsimotion","id":8582957,"avatar_url":"https://avatars.githubusercontent.com/u/8582957?v=3","gravatar_id":"","url":"https://api.github.com/users/Parsimotion","html_url":"https://github.com/Parsimotion","followers_url":"https://api.github.com/users/Parsimotion/followers","following_url":"https://api.github.com/users/Parsimotion/following{/other_user}","gists_url":"https://api.github.com/users/Parsimotion/gists{/gist_id}","starred_url":"https://api.github.com/users/Parsimotion/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Parsimotion/subscriptions","organizations_url":"https://api.github.com/users/Parsimotion/orgs","repos_url":"https://api.github.com/users/Parsimotion/repos","events_url":"https://api.github.com/users/Parsimotion/events{/privacy}","received_events_url":"https://api.github.com/users/Parsimotion/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Parsimotion/producteca-syncer","description":"Product Syncer between Producteca and other services","fork":false,"url":"https://api.github.com/repos/Parsimotion/producteca-syncer","forks_url":"https://api.github.com/repos/Parsimotion/producteca-syncer/forks","keys_url":"https://api.github.com/repos/Parsimotion/producteca-syncer/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Parsimotion/producteca-syncer/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Parsimotion/producteca-syncer/teams","hooks_url":"https://api.github.com/repos/Parsimotion/producteca-syncer/hooks","issue_events_url":"https://api.github.com/repos/Parsimotion/producteca-syncer/issues/events{/number}","events_url":"https://api.github.com/repos/Parsimotion/producteca-syncer/events","assignees_url":"https://api.github.com/repos/Parsimotion/producteca-syncer/assignees{/user}","branches_url":"https://api.github.com/repos/Parsimotion/producteca-syncer/branches{/branch}","tags_url":"https://api.github.com/repos/Parsimotion/producteca-syncer/tags","blobs_url":"https://api.github.com/repos/Parsimotion/producteca-syncer/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Parsimotion/producteca-syncer/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Parsimotion/producteca-syncer/git/refs{/sha}","trees_url":"https://api.github.com/repos/Parsimotion/producteca-syncer/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Parsimotion/producteca-syncer/statuses/{sha}","languages_url":"https://api.github.com/repos/Parsimotion/producteca-syncer/languages","stargazers_url":"https://api.github.com/repos/Parsimotion/producteca-syncer/stargazers","contributors_url":"https://api.github.com/repos/Parsimotion/producteca-syncer/contributors","subscribers_url":"https://api.github.com/repos/Parsimotion/producteca-syncer/subscribers","subscription_url":"https://api.github.com/repos/Parsimotion/producteca-syncer/subscription","commits_url":"https://api.github.com/repos/Parsimotion/producteca-syncer/commits{/sha}","git_commits_url":"https://api.github.com/repos/Parsimotion/producteca-syncer/git/commits{/sha}","comments_url":"https://api.github.com/repos/Parsimotion/producteca-syncer/comments{/number}","issue_comment_url":"https://api.github.com/repos/Parsimotion/producteca-syncer/issues/comments{/number}","contents_url":"https://api.github.com/repos/Parsimotion/producteca-syncer/contents/{+path}","compare_url":"https://api.github.com/repos/Parsimotion/producteca-syncer/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Parsimotion/producteca-syncer/merges","archive_url":"https://api.github.com/repos/Parsimotion/producteca-syncer/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Parsimotion/producteca-syncer/downloads","issues_url":"https://api.github.com/repos/Parsimotion/producteca-syncer/issues{/number}","pulls_url":"https://api.github.com/repos/Parsimotion/producteca-syncer/pulls{/number}","milestones_url":"https://api.github.com/repos/Parsimotion/producteca-syncer/milestones{/number}","notifications_url":"https://api.github.com/repos/Parsimotion/producteca-syncer/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Parsimotion/producteca-syncer/labels{/name}","releases_url":"https://api.github.com/repos/Parsimotion/producteca-syncer/releases{/id}","deployments_url":"https://api.github.com/repos/Parsimotion/producteca-syncer/deployments","created_at":"2015-11-13T17:38:10Z","updated_at":"2016-01-19T17:58:57Z","pushed_at":"2016-04-11T18:07:13Z","git_url":"git://github.com/Parsimotion/producteca-syncer.git","ssh_url":"git@github.com:Parsimotion/producteca-syncer.git","clone_url":"https://github.com/Parsimotion/producteca-syncer.git","svn_url":"https://github.com/Parsimotion/producteca-syncer","homepage":null,"size":7771,"stargazers_count":0,"watchers_count":0,"language":"CoffeeScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"development"}},"base":{"label":"Parsimotion:development","ref":"development","sha":"3ca14c7c6d988f85a88a6d51909af4485ef7e1ea","user":{"login":"Parsimotion","id":8582957,"avatar_url":"https://avatars.githubusercontent.com/u/8582957?v=3","gravatar_id":"","url":"https://api.github.com/users/Parsimotion","html_url":"https://github.com/Parsimotion","followers_url":"https://api.github.com/users/Parsimotion/followers","following_url":"https://api.github.com/users/Parsimotion/following{/other_user}","gists_url":"https://api.github.com/users/Parsimotion/gists{/gist_id}","starred_url":"https://api.github.com/users/Parsimotion/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Parsimotion/subscriptions","organizations_url":"https://api.github.com/users/Parsimotion/orgs","repos_url":"https://api.github.com/users/Parsimotion/repos","events_url":"https://api.github.com/users/Parsimotion/events{/privacy}","received_events_url":"https://api.github.com/users/Parsimotion/received_events","type":"Organization","site_admin":false},"repo":{"id":46137398,"name":"producteca-syncer","full_name":"Parsimotion/producteca-syncer","owner":{"login":"Parsimotion","id":8582957,"avatar_url":"https://avatars.githubusercontent.com/u/8582957?v=3","gravatar_id":"","url":"https://api.github.com/users/Parsimotion","html_url":"https://github.com/Parsimotion","followers_url":"https://api.github.com/users/Parsimotion/followers","following_url":"https://api.github.com/users/Parsimotion/following{/other_user}","gists_url":"https://api.github.com/users/Parsimotion/gists{/gist_id}","starred_url":"https://api.github.com/users/Parsimotion/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Parsimotion/subscriptions","organizations_url":"https://api.github.com/users/Parsimotion/orgs","repos_url":"https://api.github.com/users/Parsimotion/repos","events_url":"https://api.github.com/users/Parsimotion/events{/privacy}","received_events_url":"https://api.github.com/users/Parsimotion/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Parsimotion/producteca-syncer","description":"Product Syncer between Producteca and other services","fork":false,"url":"https://api.github.com/repos/Parsimotion/producteca-syncer","forks_url":"https://api.github.com/repos/Parsimotion/producteca-syncer/forks","keys_url":"https://api.github.com/repos/Parsimotion/producteca-syncer/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Parsimotion/producteca-syncer/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Parsimotion/producteca-syncer/teams","hooks_url":"https://api.github.com/repos/Parsimotion/producteca-syncer/hooks","issue_events_url":"https://api.github.com/repos/Parsimotion/producteca-syncer/issues/events{/number}","events_url":"https://api.github.com/repos/Parsimotion/producteca-syncer/events","assignees_url":"https://api.github.com/repos/Parsimotion/producteca-syncer/assignees{/user}","branches_url":"https://api.github.com/repos/Parsimotion/producteca-syncer/branches{/branch}","tags_url":"https://api.github.com/repos/Parsimotion/producteca-syncer/tags","blobs_url":"https://api.github.com/repos/Parsimotion/producteca-syncer/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Parsimotion/producteca-syncer/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Parsimotion/producteca-syncer/git/refs{/sha}","trees_url":"https://api.github.com/repos/Parsimotion/producteca-syncer/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Parsimotion/producteca-syncer/statuses/{sha}","languages_url":"https://api.github.com/repos/Parsimotion/producteca-syncer/languages","stargazers_url":"https://api.github.com/repos/Parsimotion/producteca-syncer/stargazers","contributors_url":"https://api.github.com/repos/Parsimotion/producteca-syncer/contributors","subscribers_url":"https://api.github.com/repos/Parsimotion/producteca-syncer/subscribers","subscription_url":"https://api.github.com/repos/Parsimotion/producteca-syncer/subscription","commits_url":"https://api.github.com/repos/Parsimotion/producteca-syncer/commits{/sha}","git_commits_url":"https://api.github.com/repos/Parsimotion/producteca-syncer/git/commits{/sha}","comments_url":"https://api.github.com/repos/Parsimotion/producteca-syncer/comments{/number}","issue_comment_url":"https://api.github.com/repos/Parsimotion/producteca-syncer/issues/comments{/number}","contents_url":"https://api.github.com/repos/Parsimotion/producteca-syncer/contents/{+path}","compare_url":"https://api.github.com/repos/Parsimotion/producteca-syncer/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Parsimotion/producteca-syncer/merges","archive_url":"https://api.github.com/repos/Parsimotion/producteca-syncer/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Parsimotion/producteca-syncer/downloads","issues_url":"https://api.github.com/repos/Parsimotion/producteca-syncer/issues{/number}","pulls_url":"https://api.github.com/repos/Parsimotion/producteca-syncer/pulls{/number}","milestones_url":"https://api.github.com/repos/Parsimotion/producteca-syncer/milestones{/number}","notifications_url":"https://api.github.com/repos/Parsimotion/producteca-syncer/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Parsimotion/producteca-syncer/labels{/name}","releases_url":"https://api.github.com/repos/Parsimotion/producteca-syncer/releases{/id}","deployments_url":"https://api.github.com/repos/Parsimotion/producteca-syncer/deployments","created_at":"2015-11-13T17:38:10Z","updated_at":"2016-01-19T17:58:57Z","pushed_at":"2016-04-11T18:07:13Z","git_url":"git://github.com/Parsimotion/producteca-syncer.git","ssh_url":"git@github.com:Parsimotion/producteca-syncer.git","clone_url":"https://github.com/Parsimotion/producteca-syncer.git","svn_url":"https://github.com/Parsimotion/producteca-syncer","homepage":null,"size":7771,"stargazers_count":0,"watchers_count":0,"language":"CoffeeScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"development"}},"_links":{"self":{"href":"https://api.github.com/repos/Parsimotion/producteca-syncer/pulls/21"},"html":{"href":"https://github.com/Parsimotion/producteca-syncer/pull/21"},"issue":{"href":"https://api.github.com/repos/Parsimotion/producteca-syncer/issues/21"},"comments":{"href":"https://api.github.com/repos/Parsimotion/producteca-syncer/issues/21/comments"},"review_comments":{"href":"https://api.github.com/repos/Parsimotion/producteca-syncer/pulls/21/comments"},"review_comment":{"href":"https://api.github.com/repos/Parsimotion/producteca-syncer/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/Parsimotion/producteca-syncer/pulls/21/commits"},"statuses":{"href":"https://api.github.com/repos/Parsimotion/producteca-syncer/statuses/7b2415b7ff1eb4511d60883c476302cb50a1aaed"}}}}