{"action":"opened","issue":{"url":"https://api.github.com/repos/vsivsi/meteor-job-collection/issues/90","labels_url":"https://api.github.com/repos/vsivsi/meteor-job-collection/issues/90/labels{/name}","comments_url":"https://api.github.com/repos/vsivsi/meteor-job-collection/issues/90/comments","events_url":"https://api.github.com/repos/vsivsi/meteor-job-collection/issues/90/events","html_url":"https://github.com/vsivsi/meteor-job-collection/issues/90","id":91265575,"number":90,"title":"Simple setup of a job running a function every 2 minutes only available for server","user":{"login":"miri-am","id":10519693,"avatar_url":"https://avatars.githubusercontent.com/u/10519693?v=3","gravatar_id":"","url":"https://api.github.com/users/miri-am","html_url":"https://github.com/miri-am","followers_url":"https://api.github.com/users/miri-am/followers","following_url":"https://api.github.com/users/miri-am/following{/other_user}","gists_url":"https://api.github.com/users/miri-am/gists{/gist_id}","starred_url":"https://api.github.com/users/miri-am/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/miri-am/subscriptions","organizations_url":"https://api.github.com/users/miri-am/orgs","repos_url":"https://api.github.com/users/miri-am/repos","events_url":"https://api.github.com/users/miri-am/events{/privacy}","received_events_url":"https://api.github.com/users/miri-am/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-06-26T14:27:52Z","updated_at":"2015-06-26T14:27:52Z","closed_at":null,"body":"Not an issue but a question: I am trying to setup something very simple and maybe somebody can just give me a quick hint.  I have a function that updates multiple documents in a collection called \"checkExpiredDocuments\". I want this function to run every 2 minutes forever, persisting server restarts.\r\n\r\nIs this the correct setup for my requirement? Do I need the queue, is the ` //EXECUTE THE DESIRED FUNCTION TO RUN HERE` placed correctly?  \r\n\r\nI have the feeling I am overcomplicating things.\r\n\r\nThis is what I am currently doing: \r\n```\r\n//file sever.js\r\nvar myJobs = JobCollection('defaultJobCollection'); //create job collection\r\n\r\nmyJobs.deny({\r\n  admin: function (userId, method, params) {\r\n    return true; //only allow server to use job collection\r\n  }\r\n});\t\r\n\r\n//create a job. Does not need data\r\nvar job = new Job(myJobs, 'checkExpiredDocuments', {});\r\njob.repeat({\r\n    schedule: myJobs.later.parse.text('every 2 mins')   // Rerun this job every minute\r\n});\r\njob.save({cancelRepeats: true});\r\n\r\nMeteor.startup(function() {\r\n    myJobs.startJobServer();\r\n    var queue = myJobs.processJobs(\r\n        'checkExpiredDocuments', {},\r\n        function (job, callback) {\r\n          //EXECUTE THE DESIRED FUNCTION TO RUN HERE (is this correct)\r\n           job.done();\r\n\t   callback();\r\n     });\r\n});\r\n"}}