Skip to content

Commit

Permalink
Fixed typo
Browse files Browse the repository at this point in the history
  • Loading branch information
Nyholm committed Mar 26, 2021
1 parent cd38e49 commit d534883
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/Runtime/LambdaRuntime.php
Original file line number Diff line number Diff line change
Expand Up @@ -112,10 +112,10 @@ public function processNextEvent($handler): void
\assert($context instanceof Context);

if ($this->timeout > 0) {
Timeout::timoutAfter($this->timeout);
Timeout::timeoutAfter($this->timeout);
} elseif ($this->timeout === 0 && 0 < $context->getRemainingTimeInMillis()) {
// Throw exception one second before Lambda pulls the plug.
Timeout::timoutAfter(max(1, (int) floor($context->getRemainingTimeInMillis() / 1000) - 1));
Timeout::timeoutAfter(max(1, (int) floor($context->getRemainingTimeInMillis() / 1000) - 1));
}

$this->ping();
Expand Down
6 changes: 3 additions & 3 deletions src/Timeout/Timeout.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public static function enable(): void
}

if ($timeout > 0) {
self::timoutAfter($timeout);
self::timeoutAfter($timeout);

return;
}
Expand All @@ -36,7 +36,7 @@ public static function enable(): void
$deadlineMs = $context['deadlineMs'];
$remainingTime = $deadlineMs - intval(microtime(true) * 1000);

self::timoutAfter((int) floor($remainingTime / 1000));
self::timeoutAfter((int) floor($remainingTime / 1000));

return;
}
Expand Down Expand Up @@ -74,7 +74,7 @@ public static function init(): bool
/**
* Set a timer to throw an exception.
*/
public static function timoutAfter(int $seconds): void
public static function timeoutAfter(int $seconds): void
{
self::init();
pcntl_alarm($seconds);
Expand Down
2 changes: 1 addition & 1 deletion tests/Timeout/TimeoutTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ public function testEnableWithContext()
public function testTimeoutAfter()
{
$start = microtime(true);
Timeout::timoutAfter(2);
Timeout::timeoutAfter(2);
try {
sleep(4);
$this->fail('We expect a LambdaTimeout before we reach this line');
Expand Down

0 comments on commit d534883

Please sign in to comment.