есть такая простая штука
Console::startProgress($done, $total);
foreach ($udi as $key => $item) {
$changedItem = \Yii::$app->db->createCommand('select overprice, overprice_type from shop_product_changed_dealer where dealer_item_id=:id',[':id' => $item['id']])->queryOne();
$done++;
if ($done % 1000 == 0) {
gc_collect_cycles();
print_r(memory_get_usage() . "\n");
Console::updateProgress($done, $total);
}
}
Yii::$app->db течет безжалостно. не оставляет ни единого шанса.
0% (1000/1230161) ETA: n/a 698202152
0% (2000/1230161) ETA: n/a 701976296
0% (3000/1230161) ETA: n/a 705488296
0% (4000/1230161) ETA: 613 sec. 709000296
0% (5000/1230161) ETA: 613 sec. 713036584
0% (6000/1230161) ETA: 613 sec. 716548584
0% (7000/1230161) ETA: 613 sec. 720060584
0% (8000/1230161) ETA: 613 sec. 723572584
0% (9000/1230161) ETA: 488 sec. 727084584