Skip to content

Commit

Permalink
Keys: fix type error and actually write expiry time.
Browse files Browse the repository at this point in the history
  • Loading branch information
dasgarner committed Dec 13, 2024
1 parent 41abe2c commit 518e566
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion index.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@

// TODO: ratchet does not support PHP8
error_reporting(E_ALL ^ E_DEPRECATED);
ini_set('display_errors', 0);

set_error_handler(function($severity, $message, $file, $line) {
if (!(error_reporting() & $severity)) {
Expand Down Expand Up @@ -134,7 +135,6 @@
$http->listen($socket);
$http->on('error', function (Exception $exception) use ($log) {
$log->error('http: ' . $exception->getMessage());
$log->debug('stack: ' . $exception->getTraceAsString());
});

$log->info('HTTP listening');
Expand Down
6 changes: 3 additions & 3 deletions src/Entity/Queue.php
Original file line number Diff line number Diff line change
Expand Up @@ -168,15 +168,15 @@ public function addKey(string $instance, string $key): void
}

// If a key already exists push the expiry time
foreach ($this->instances[$instance]['keys'] as $existingKey) {
foreach ($this->instances[$instance]['keys'] as $index => $existingKey) {
if ($existingKey['key'] === $key) {
$existingKey['expires'] = time() + 3600;
$this->instances[$instance]['keys'][$index]['expires'] = time() + 3600;
return;
}
}

// Not found
$this->instances[$instance]['keys'] = [
$this->instances[$instance]['keys'][] = [
'key' => $key,
'expires' => time() + 86400,
];
Expand Down

0 comments on commit 518e566

Please sign in to comment.