Php scheduled task cycle execution of replace operation is interrupted for no reason

problem description

will stop running after executing 20000 + pieces of data. is that the reason for the timeout?

the environmental background of the problems and what methods you have tried

invalid set_time_limit (0)

related codes

/ / Please paste the code text below (do not replace the code with pictures)
public function doMerchantInfo () {

    $merchantId = $input->get("merchantId");
    $where = " grade_id <> 0 ";
    $merchantNumber = Libs_Merchant_Merchant::getMerchantNumber($where);
    if ($merchantNumber) {
        for ($i = 0; $i < $merchantNumber; $i += 5000) {
            $merchantInfo = Libs_Merchant_Merchant::getMerchantInfo(array("id"), $where, array("id" => "asc"), $i, 5000);

            if (is_array($merchantInfo) && !empty($merchantInfo)) {
                foreach ($merchantInfo as $val) {
                    echo "\n";
                    echo $val["id"];
                    echo "\n";
                    
                    self::setCache("Merchant_MerchantInfo", array("merchantId" => $val["id"]));
                    
                    // 
                    Db_ShopLog::replaceData("zs_merchant_cache_log", array(
                        "mer_id"   => $val["id"],
                        "add_time" => date("Y-m-d H:i:s"),                            
                    ));                        
                }
            }
            unset($merchantInfo);
        }
    }
    exit;
}

what result do you expect? What is the error message actually seen?

Php
Aug.10,2021

>>/data/xx.log 2>&1   // 
nohup.out
Menu