From df1f98d5f7cabe2c39c0ae05c9951a4093a54ef5 Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Sat, 11 Nov 2023 07:23:42 -0700 Subject: [PATCH] Add FeedInsertPipeline job --- .../HomeFeedPipeline/FeedInsertPipeline.php | 76 +++++++++++++++++++ 1 file changed, 76 insertions(+) create mode 100644 app/Jobs/HomeFeedPipeline/FeedInsertPipeline.php diff --git a/app/Jobs/HomeFeedPipeline/FeedInsertPipeline.php b/app/Jobs/HomeFeedPipeline/FeedInsertPipeline.php new file mode 100644 index 000000000..6ccdc18ef --- /dev/null +++ b/app/Jobs/HomeFeedPipeline/FeedInsertPipeline.php @@ -0,0 +1,76 @@ +status->id; + } + + /** + * Get the middleware the job should pass through. + * + * @return array + */ + public function middleware(): array + { + return [(new WithoutOverlapping("hfp:f-insert:sid:{$this->status->id}"))->shared()->dontRelease()]; + } + + /** + * Create a new job instance. + */ + public function __construct(Status $status) + { + $this->status = $status; + } + + /** + * Execute the job. + */ + public function handle(): void + { + $status = $this->status; + $sid = $status->id; + $pid = $status->profile_id; + $ids = FollowerService::localFollowerIds($pid); + + foreach($ids as $id) { + HomeTimelineService::add($id, $sid); + } + } +}