mirror of
https://github.com/DanielnetoDotCom/YouPHPTube
synced 2025-10-03 09:49:28 +02:00
Update
This commit is contained in:
parent
f134abb8e0
commit
5531ed91ec
1 changed files with 2 additions and 9 deletions
|
@ -13,7 +13,6 @@ require_once $global['systemRootPath'] . 'plugin/YPTSocket/functions.php';
|
||||||
|
|
||||||
class Message implements MessageComponentInterface {
|
class Message implements MessageComponentInterface {
|
||||||
const MSG_TO_ALL_TIMEOUT = 5;
|
const MSG_TO_ALL_TIMEOUT = 5;
|
||||||
static $msgToAllTimeoutLastTime = 0;
|
|
||||||
static $msgToAll = array();
|
static $msgToAll = array();
|
||||||
static $mem_usage;
|
static $mem_usage;
|
||||||
static $mem;
|
static $mem;
|
||||||
|
@ -479,11 +478,7 @@ class Message implements MessageComponentInterface {
|
||||||
}
|
}
|
||||||
|
|
||||||
public function msgToAll($msg, $type = \SocketMessageType::UNDEFINED) {
|
public function msgToAll($msg, $type = \SocketMessageType::UNDEFINED) {
|
||||||
if(Message::$msgToAllTimeoutLastTime + Message::MSG_TO_ALL_TIMEOUT < time()){
|
self::$msgToAll[] = array('msg'=>$msg, 'type'=>$type);
|
||||||
$this->_msgToAll( $msg, $type);
|
|
||||||
}else{
|
|
||||||
self::$msgToAll[] = array('msg'=>$msg, 'type'=>$type);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function _msgToAll( $msg, $type = "") {
|
public function _msgToAll( $msg, $type = "") {
|
||||||
|
@ -512,9 +507,7 @@ class Message implements MessageComponentInterface {
|
||||||
$this->msgToResourceId($msg, $client['resourceId'], $type, $totals);
|
$this->msgToResourceId($msg, $client['resourceId'], $type, $totals);
|
||||||
}
|
}
|
||||||
$end = number_format(microtime(true) - $start, 4);
|
$end = number_format(microtime(true) - $start, 4);
|
||||||
$ago = time() - Message::$msgToAllTimeoutLastTime;
|
_log_message("msgToAll FROM {$type} Total Clients: " . count($rows) . " in {$end} seconds");
|
||||||
_log_message("msgToAll FROM {$type} Total Clients: " . count($rows) . " in {$end} seconds, last msgToAll was {$ago} seconds ago");
|
|
||||||
Message::$msgToAllTimeoutLastTime = time();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function msgToAllSameVideo($videos_id, $msg) {
|
public function msgToAllSameVideo($videos_id, $msg) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue