crontab
crontab copied to clipboard
How to execute multiple crontab inside onWorkerStart .
$crontab_worker->onWorkerStart = function ($crontab_worker) use ($app) {
new Crontab('0 0 * * *', $app->boot('/article/sitemap/main'),'sitemap');
new Crontab('*/15 * * * *', $app->boot('/multimedia/migration'),'migration_image');
new Crontab('*/19 * * * *', $app->boot('/article/migration'),'migration_article');
};
as you can see, if we execute multiple crontabs there, the memory usage keeps increasing. I am not sure if it's the right way to execute multiple crontab all at once.
一个进程运行多个crontab一般没有问题。 随着程序不断运行,内存上涨是正常的,只要不是无限上涨到100M+就没事。 如果很不幸内存是无限上涨的,需要将业务代码单独拿出来无限运行去测试,定位是哪里出现了内存泄露。