Top Menu

php同时兼容cli和web打印结果输出

使用同一套程序逻辑,为了设置定时任务在cli中执行,需要同时兼容cli和web端的输出。

整合输出

使用一个输出函数接管cli和web的所有的输出

function add_message($message,$color='black'){ if(!defined('STDIN') ) { echo "<script type='text/javascript'>add('$message','$color');</script>"; ob_flush();flush();} if(defined('STDIN') ) { echo( color_console_output(" ".$message." \n",$color) );} }

Continue Reading 0

Selenium Grid的各种超时设置

Selenium Grid里有各种超时,包括slot的和session的以及webdriver的

slot的超时设置

slot属于node下的子节点,一般Selenium Grid会根据cpu核心数量分配对应的slot槽位,每个slot槽位可以同时允许一个session运行。

有时候这个session会因为代码异常中断没有触发session销毁机制,导致session长期占用slot槽位,当所有slot槽位都满了以后,这个node的后续请求只能积压在queue中,导致node被阻塞。

为了解决这个问题,在grid的config文件中可以设置session-timeout来释放超时的slot槽位

[node] #Let X be the session-timeout in seconds. The Node will automatically kill a session that has not had any activity in the last X seconds. This will release the slot for other tests. session-timeout = 1

Continue Reading 0

Powered by WordPress. Designed by WooThemes