reformat: fix codestyle

This commit is contained in:
2025-12-06 23:50:25 +03:00
parent 7372b9c330
commit 64f2fc5364
6 changed files with 7 additions and 11 deletions

View File

@@ -170,9 +170,9 @@ class SettingsHandler
// For now, let's use global retrieval via cache if possible, or assume it's injected.
// But wait, getLastCronRunDate logic was in controller.
// SchedulerService stores last run in cache. We have $this->cache here.
$lastRunTimestamp = $this->cache->get("scheduler.global_last_run");
if ($lastRunTimestamp) {
return date('d.m.Y H:i:s', (int)$lastRunTimestamp);
}

View File

@@ -37,4 +37,3 @@ class ScheduleJobRegistry
return $this->jobs;
}
}

View File

@@ -41,4 +41,3 @@ class SchedulerResult
];
}
}

View File

@@ -45,7 +45,7 @@ class SchedulerService
$this->acquireGlobalLock();
// Since we want to run every 5 minutes, running it more frequently won't trigger jobs earlier than due,
// but locking might prevent overlap if previous run takes > 5 mins.
// However, updating global last run on every attempt might be useful for diagnostics,
// However, updating global last run on every attempt might be useful for diagnostics,
// but strictly speaking, we only care if tasks were processed.
$this->updateGlobalLastRun();
@@ -105,10 +105,9 @@ class SchedulerService
$duration = microtime(true) - $startTime;
$this->updateLastRun($id);
$this->logger->info("Job executed: {$name}", ['duration' => $duration]);
$result->addExecuted($name, $duration);
} catch (Throwable $e) {
$this->updateLastFailure($id, $e->getMessage());
$this->logger->error("Job failed: {$name}", ['exception' => $e]);
@@ -116,7 +115,6 @@ class SchedulerService
} finally {
$this->unlockJob($id);
}
} catch (Throwable $e) {
$this->logger->error("Error processing job {$name}: " . $e->getMessage());
$result->addFailed($name, 'Processing error: ' . $e->getMessage());
@@ -146,7 +144,7 @@ class SchedulerService
private function lockJob(string $id): void
{
// 30 minutes max execution time for a single job safe-guard
$this->cache->set("scheduler.lock.{$id}", 1, 1800);
$this->cache->set("scheduler.lock.{$id}", 1, 1800);
}
private function unlockJob(string $id): void
@@ -163,7 +161,7 @@ class SchedulerService
$lastRunDate = (new DateTime())->setTimestamp((int)$lastRun);
$now = new DateTime();
return $lastRunDate->format('Y-m-d H:i') === $now->format('Y-m-d H:i');
}

View File

@@ -6,4 +6,3 @@ interface TaskInterface
{
public function execute(): void;
}

View File

@@ -4,6 +4,7 @@ parameters:
- src
- bastion
- framework
- console
scanDirectories:
- stubs