mshanemc / deploy-to-sfdx

the power behind hands-on workshops, demo booths, and platform trial
BSD 3-Clause "New" or "Revised" License
88 stars 43 forks source link

Dyno in an exit loop when the pool is empty #90

Closed tbalthazar closed 4 years ago

tbalthazar commented 4 years ago

Hi @mshanemc,

Looking at the Procfile, I noticed that the process that monitors the pool exits every time the pool is empty, causing the dyno to restart each time.

If the pool is empty most of the time, it means the dyno will be on an exit loop, constantly restarting. I don't know the specifics of this application and I'm not a Javascript expert, so please forgive me if I'm missing something, but I'm wondering if something like this would work better for this use case:

import { poolBuild } from '../lib/poolBuild';

(async () => {
    while (true) {
        let builtSomething = await poolBuild();
        if (!builtSomething) {
            // the pool is empty, let's wait N seconds and try again
            sleep(5);
        }
    }
})();

What do you think?

mshanemc commented 4 years ago

That process should have 0 "normal" dynos running. It runs via one-off dynos initiated by the poolwatcher process

this project uses one-off dynos and queues for elastic scale and efficiency

docs about heroku setup: https://github.com/mshanemc/deploy-to-sfdx#heroku-setup

tbalthazar commented 4 years ago

Thanks for the clarification and quick answer @mshanemc!