#Running 1-off task in a Kubernetes Cronjob - How to exit?
6 messages · Page 1 of 1 (latest)
I would either use NestFactory.createApplicationContext to avoid any HTTP engine, or just use nest-commander for the CLI app
But imagine this one-off job takes 1h to run, it might need HTTP engine to act as a health probe, right?
Or would you skip health probes in such context?
Are you expecting to make health probe checks against one-off tasks?
Well this one should last few sec, but in the future we might get longer tasks, so I wonder what's the best practice with HTTP frameworks like Nest 🙂
Hey! For long running processes that will benefit from health probe you can require the service from main.ts with app.get({Service}) and start it directly. Then just wait for the promise to resolve. and when that's done you can close the app with await app.close().