Completed
Push — master ( 143878...f45699 )
by Taosikai
14:33
created

ReviewPublicConnection::getInterval()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 0
dl 0
loc 4
rs 10
c 0
b 0
f 0
1
<?php
2
3
/*
4
 * This file is part of the slince/spike package.
5
 *
6
 * (c) Slince <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Spike\Server\ChunkServer\Timer;
13
14
/**
15
 * @codeCoverageIgnore
16
 */
17
class ReviewPublicConnection extends Timer
18
{
19
    /**
20
     * {@inheritdoc}
21
     */
22
    public function __invoke()
23
    {
24
        foreach ($this->chunkServer->getPublicConnections() as $publicConnection) {
25
            if ($publicConnection->getWaitingDuration() > 120) {
26
                $this->chunkServer->closePublicConnection($publicConnection, 'Waiting for more than 60 seconds without responding');
27
            }
28
        }
29
    }
30
31
    /**
32
     * {@inheritdoc}
33
     */
34
    public function isPeriodic()
35
    {
36
        return true;
37
    }
38
39
    /**
40
     * {@inheritdoc}
41
     */
42
    public function getInterval()
43
    {
44
        return  60 * 1;
45
    }
46
}