I have such method in controller, that simple sets value of status field to 0 or 1.
public function actionNews_status($id,$status){
$status = ($status==1)?1:0;
$number = false;
$news = News::findOne($id);
if(!is_null($news)){
$news->status = $status;
$number = $news->save();
Redis::rset($CACHE_mat, null);
}
return json_encode(['status'=>$number]);
}
This method works for about 20 seconds.
I learned that the status field itself is updated immediately, since the query to the table instantly shows the changes. But the save method continues after that to work for a long time.
Then I found out the following… Slowly running the afterSave method call at the end of the updateInternal. But before the line with this call, the script is executed quickly.
Slowly works a call the afterSave by itself, not a code inside afterSave method and not code before afterSave calling.
Why this can happen?