mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-07-13 03:27:39 +03:00
Improved requestSleep()
This commit is contained in:
parent
fb98ca6fe7
commit
787f3a0cbd
1 changed files with 6 additions and 7 deletions
|
|
@ -1304,20 +1304,19 @@ class Actions
|
||||||
return $aResult;
|
return $aResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
private function requestSleep(int $iWait = 1, int $iDelay = 1): void
|
protected function requestSleep(int $iDelay = 1): void
|
||||||
{
|
{
|
||||||
if (0 < $iDelay && 0 < $iWait) {
|
$time = \microtime(true) - $_SERVER['REQUEST_TIME_FLOAT'];
|
||||||
if ($iWait > \time() - $_SERVER['REQUEST_TIME_FLOAT']) {
|
if ($iDelay > $time) {
|
||||||
\sleep($iDelay);
|
\usleep(($iDelay - $time) * 1000000);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private function loginErrorDelay(): void
|
protected function loginErrorDelay(): void
|
||||||
{
|
{
|
||||||
$iDelay = (int)$this->Config()->Get('labs', 'login_fault_delay', 0);
|
$iDelay = (int)$this->Config()->Get('labs', 'login_fault_delay', 0);
|
||||||
if (0 < $iDelay) {
|
if (0 < $iDelay) {
|
||||||
$this->requestSleep(1, $iDelay);
|
$this->requestSleep($iDelay);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue