crontab icon indicating copy to clipboard operation
crontab copied to clipboard

How to execute multiple crontab inside onWorkerStart .

Open zikezhang opened this issue 1 year ago • 1 comments

$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.

Snipaste_2023-12-27_20-16-54

zikezhang avatar Dec 28 '23 01:12 zikezhang

一个进程运行多个crontab一般没有问题。 随着程序不断运行,内存上涨是正常的,只要不是无限上涨到100M+就没事。 如果很不幸内存是无限上涨的,需要将业务代码单独拿出来无限运行去测试,定位是哪里出现了内存泄露。

walkor avatar Dec 28 '23 14:12 walkor