Heroku workers for node.js

I start with Heroku, and I have a webapp that has a part that should run once a week (preferably Mondays). I read something about workers: here and here and here ... But I still have a lot of doubts:

1) These workers, working in the background without strict control, cannot be scheduled to run once a week. or am I wrong? If I am wrong, how can I plan this?

2) To make them work, what exactly do I need to do? A type

web: node webApp.js worker: node worker.js 

in Procfile (where worker.js is part of a program that should only run once a week). And it's all? Nothing more?? so easy??

3) And the last ... but the most important. “The flat issue of money” ... One dinosaur is the same as one worker, so if you have a dinosaur for the Internet, you need to buy another one for the worker ... no? And according to the price list, emergency dinarity costs $ 34.5 (€ 27.87). It's not cheap ... so I want to know if I'm right, do I need to buy dyno if you want to run a worker?

+5
source share
1 answer

You may have found that the addition to the Heroku Scheduler ( https://devcenter.heroku.com/articles/scheduler ) is a "reasonably good" low cost option. You pay for the hours for which the scheduled tasks are performed, so if you have a regular job that takes just a short time to start, it will work much cheaper than a continuous workflow.

This is not as flexible with regard to planning as other options. It can be configured to perform a task at a specific time every day or hourly. Therefore, if you want your task to run only on Mondays, you will need to run the scheduler daily, and then check the day in your worker.js and exit immediately on other days.

+4
source

Source: https://habr.com/ru/post/1208703/


All Articles