mqttService->pending(); } catch (MQTTException $exception) { $this->logger->warning($exception->getMessage(), ['exception' => $exception]); return 0; } } public function push(array $jobConfiguration): array { try { $now = (new DateTimeImmutable('now', new DateTimeZone($_ENV['TZ'] ?? 'America/Santiago'))); } catch (DateMalformedStringException | DateInvalidTimeZoneException) { $now = new DateTimeImmutable(); } $data = [ 'id' => $now->format('Uu'), 'configuration' => $jobConfiguration, 'executed' => false, 'created_at' => $now->format('Y-m-d H:i:s'), 'updated_at' => null, 'retries' => 0 ]; try { $this->mqttService->set(json_encode($data)); } catch (MQTTException $exception) { $this->logger->warning($exception->getMessage(), ['exception' => $exception]); } return $data; } }