How to Restart the Current Process After Handling a Certain Number of Requests in Workerman
To keep Workerman more streamlined, this setting is not provided directly. However, you can achieve this functionality with just a few lines of code.
$worker->onMessage = function($connection, $data) {
static $request_count;
// Business processing omitted
if(++$request_count > 10000) {
// Exit the current process after handling 10000 requests, the master process will automatically restart a new process
Worker::stopAll();
}
};