A added timeout information
This commit is contained in:
parent
6f115a2a72
commit
bbcb943daa
|
|
@ -470,10 +470,11 @@ class Handler implements MessageComponentInterface
|
||||||
) {
|
) {
|
||||||
$pidcache_data = 'dedicated_data_'.$pid;
|
$pidcache_data = 'dedicated_data_'.$pid;
|
||||||
$pidcache_done = 'dedicated_data_'.$pid.'_done';
|
$pidcache_done = 'dedicated_data_'.$pid.'_done';
|
||||||
|
$pidcache_complete = 'dedicated_data_'.$pid.'_complete';
|
||||||
|
|
||||||
if (
|
if (
|
||||||
cache()->has($pidcache_start)
|
cache()->has($pidcache_start)
|
||||||
&& ($diff = microtime(true) - ((int) cache()->get($pidcache_start))) > 20
|
&& ($diff = microtime(true) - ((int) cache()->get($pidcache_start))) > 60
|
||||||
) {
|
) {
|
||||||
if (! $optional) {
|
if (! $optional) {
|
||||||
$connection->send(json_encode([
|
$connection->send(json_encode([
|
||||||
|
|
@ -486,6 +487,7 @@ class Handler implements MessageComponentInterface
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->channelManager->loop->cancelTimer($timer);
|
$this->channelManager->loop->cancelTimer($timer);
|
||||||
|
cache()->put($pidcache_complete, true, 360);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cache()->has($pidcache_done)) {
|
if (cache()->has($pidcache_done)) {
|
||||||
|
|
|
||||||
|
|
@ -50,6 +50,13 @@ class MockConnection extends Connection implements \Ratchet\ConnectionInterface
|
||||||
|
|
||||||
public function send($data)
|
public function send($data)
|
||||||
{
|
{
|
||||||
|
if(cache()->get('dedicated_data_'.$pid.'_complete')){
|
||||||
|
Log::error('[MockConnection] Send for pid: ' . getmypid() . ' which is already completed and does not check for new data', [
|
||||||
|
'data' => $data,
|
||||||
|
]);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
Log::channel('websocket')->info('[MockConnection] Send for pid: ' . getmypid(), [
|
Log::channel('websocket')->info('[MockConnection] Send for pid: ' . getmypid(), [
|
||||||
'data' => $data,
|
'data' => $data,
|
||||||
]);
|
]);
|
||||||
|
|
@ -59,19 +66,6 @@ class MockConnection extends Connection implements \Ratchet\ConnectionInterface
|
||||||
cache()->put($key, $data, 60);
|
cache()->put($key, $data, 60);
|
||||||
cache()->put($key . '_done', true, 60);
|
cache()->put($key . '_done', true, 60);
|
||||||
|
|
||||||
// ==== Alternative way without using cache
|
|
||||||
// if (is_string($data)) {
|
|
||||||
// $d = json_decode($data, true);
|
|
||||||
|
|
||||||
// \App\Events\TenantEvent::dispatch(
|
|
||||||
// optional(optional(tenant())->tenantable)->public_id,
|
|
||||||
// $d['event'],
|
|
||||||
// (is_array($d['data']))
|
|
||||||
// ? $d['data']
|
|
||||||
// : ['data' => $d['data']]
|
|
||||||
// );
|
|
||||||
// }
|
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue