Skip to content

Instantly share code, notes, and snippets.

@tuupola
Created April 30, 2021 09:23
Show Gist options
  • Save tuupola/e10990ed707f6a300123e782f8d99143 to your computer and use it in GitHub Desktop.
Save tuupola/e10990ed707f6a300123e782f8d99143 to your computer and use it in GitHub Desktop.
while ($worker->work()) {
if (1000 < ++$jobs) {
print "Job limit reached, exiting worker {$pid}.\n";
$worker->unregisterAll();
exit();
}
$memory = memory_get_usage(true);
print "Worker {$pid} running job number {$jobs} memory usage is {$memory}.\n";
if (md5_file(__FILE__) !== $md5) {
print __FILE__ . " was modified, exiting worker {$pid}.\n";
$worker->unregisterAll();
exit();
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment