From 4dc9d1a481417bb78606996fa75c791bb646f44f Mon Sep 17 00:00:00 2001 From: winter Date: Sat, 14 Dec 2024 16:26:30 +0000 Subject: job queue and workers and loggers! --- Digitigrade/Job/FetchObject.php | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 Digitigrade/Job/FetchObject.php (limited to 'Digitigrade/Job/FetchObject.php') diff --git a/Digitigrade/Job/FetchObject.php b/Digitigrade/Job/FetchObject.php new file mode 100644 index 0000000..227e05b --- /dev/null +++ b/Digitigrade/Job/FetchObject.php @@ -0,0 +1,25 @@ +type = $type; + $this->uri = $uri; + $this->remainingTries = 8; + } + + public function run() { + assert(is_subclass_of($this->type, FetchableModel::class)); + Logger::getInstance()->info("fetching $this->type at $this->uri"); + if ($this->type::findByUri($this->uri, forceRefetch: true) == null) { + throw new \RuntimeException("remote object doesn't seem to exist"); + } + } +} \ No newline at end of file -- cgit v1.3