PHP彗星usleep阻塞Apache MPM? [英] PHP comet usleep blocking apache mpm?

查看:87
本文介绍了PHP彗星usleep阻塞Apache MPM?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个彗星,我以这种方式运行了一个while循环

I've a comet there I run an while loop in this way

$items = $statement->fetchAll();//statement is a PDO Statement
$iteration = 0;
while(count($items) == 0 && $iteration < 100){
    $items = $statement->fetchAll();
    usleep(10000);
    ++$iteration;
}

当彗星运行时,我可以看到所有其他HTTP请求正在等待处理。甚至非数据库请求都处于挂起状态。为什么?

When the comet runs I can see all other HTTP requests are pending. even non-database requests are pending. Why ?

推荐答案

您需要使用 PDO :: commit 手动提交

请参阅有关此行为的文档:

Please see the docs about this behavior:

http://www.php.net/manual/de/pdo.commit.php

http: //www.php.net/manual/en/pdo.transactions.php

这篇关于PHP彗星usleep阻塞Apache MPM?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆