From 6aa65b9a21eedc7fe38a17ddbc0d1000e2b395a8 Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Sat, 11 Nov 2023 05:49:41 -0700 Subject: [PATCH] Add FeedWarmCachePipeline --- .../FeedWarmCachePipeline.php | 67 +++++++++++++++++++ 1 file changed, 67 insertions(+) create mode 100644 app/Jobs/HomeFeedPipeline/FeedWarmCachePipeline.php diff --git a/app/Jobs/HomeFeedPipeline/FeedWarmCachePipeline.php b/app/Jobs/HomeFeedPipeline/FeedWarmCachePipeline.php new file mode 100644 index 000000000..00cdbda65 --- /dev/null +++ b/app/Jobs/HomeFeedPipeline/FeedWarmCachePipeline.php @@ -0,0 +1,67 @@ +pid; + } + + /** + * Get the middleware the job should pass through. + * + * @return array + */ + public function middleware(): array + { + return [(new WithoutOverlapping("hfp:warm-cache:pid:{$this->pid}"))->shared()->dontRelease()]; + } + + /** + * Create a new job instance. + */ + public function __construct($pid) + { + $this->pid = $pid; + } + + /** + * Execute the job. + */ + public function handle(): void + { + $pid = $this->pid; + HomeTimelineService::warmCache($pid, true, 400, true); + } +}