Skip to content

Commit

Permalink
Convert strftime to date due to php 8.1 depreciation
Browse files Browse the repository at this point in the history
  • Loading branch information
daneren2005 committed Aug 1, 2022
1 parent 9a1ac4e commit e0040cb
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion lib/Resque/Failure/Redis.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class Resque_Failure_Redis implements Resque_Failure_Interface
public function __construct($payload, $exception, $worker, $queue)
{
$data = new stdClass;
$data->failed_at = strftime('%a %b %d %H:%M:%S %Z %Y');
$data->failed_at = date('D M d H:i:s T Y');
$data->payload = $payload;
$data->exception = get_class($exception);
$data->error = $exception->getMessage();
Expand Down
2 changes: 1 addition & 1 deletion lib/Resque/Log.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public function log($level, $message, array $context = array())
if ($this->verbose) {
fwrite(
STDOUT,
'[' . $level . '] [' . strftime('%T') . '] [' . getmypid() . '] ' . $this->interpolate($message, $context) . PHP_EOL
'[' . $level . '] [' . date('H:i:s') . '] [' . getmypid() . '] ' . $this->interpolate($message, $context) . PHP_EOL
);
return;
}
Expand Down
10 changes: 5 additions & 5 deletions lib/Resque/Worker.php
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ public function work($interval = Resque::DEFAULT_INTERVAL, $blocking = false)
// Forked and we're the child. Run the job.
if ($this->child === 0 || $this->child === false) {
$this->logger->log(Psr\Log\LogLevel::DEBUG, 'I am the child and starting to run');
$status = 'Processing ' . $job->queue . ' since ' . strftime('%F %T');
$status = 'Processing ' . $job->queue . ' since ' . date('Y-m-d H:i:s');
$this->updateProcLine($status);
$this->logger->log(Psr\Log\LogLevel::INFO, $status);
$this->perform($job);
Expand All @@ -239,8 +239,8 @@ public function work($interval = Resque::DEFAULT_INTERVAL, $blocking = false)

if($this->child > 0) {
// Parent process, sit and wait
$status = 'Forked ' . $this->child . ' at ' . strftime('%F %T');
$this->updateProcLine('Forked ' . $this->child . ' at ' . strftime('%F %T'));
$status = 'Forked ' . $this->child . ' at ' . date('Y-m-d H:i:s');
$this->updateProcLine($status);
$this->logger->log(Psr\Log\LogLevel::INFO, 'Forked {child} for {worker}', Array(
'child' => $this->child,
'worker' => $this
Expand Down Expand Up @@ -595,7 +595,7 @@ public function workerPids()
public function registerWorker()
{
Resque::redis()->sadd('workers', (string)$this);
Resque::redis()->set('worker:' . (string)$this . ':started', strftime('%a %b %d %H:%M:%S %Z %Y'));
Resque::redis()->set('worker:' . (string)$this . ':started', date('D M d H:i:s T Y'));
}

/**
Expand Down Expand Up @@ -627,7 +627,7 @@ public function workingOn(Resque_Job $job)
$job->updateStatus(Resque_Job_Status::STATUS_RUNNING);
$data = json_encode(array(
'queue' => $job->queue,
'run_at' => strftime('%a %b %d %H:%M:%S %Z %Y'),
'run_at' => date('D M d H:i:s T Y'),
'payload' => $job->payload
));
Resque::redis()->set('worker:' . $job->worker, $data);
Expand Down

0 comments on commit e0040cb

Please sign in to comment.