1
0
Fork 0
forked from mirror/pixelfed

Update command

This commit is contained in:
Daniel Supernault 2019-05-13 01:09:36 -06:00
parent d46ae1e628
commit 4cafb8a3ea
No known key found for this signature in database
GPG key ID: 0DEF1C662C9033F7

View file

@ -40,19 +40,24 @@ class SeedFollows extends Command
*/ */
public function handle() public function handle()
{ {
$limit = 10000; $limit = 100;
for ($i = 0; $i < $limit; $i++) { for ($i = 0; $i < $limit; $i++) {
try { try {
$actor = Profile::inRandomOrder()->firstOrFail(); $actor = Profile::whereDomain(false)->inRandomOrder()->firstOrFail();
$target = Profile::inRandomOrder()->firstOrFail(); $target = Profile::whereDomain(false)->inRandomOrder()->firstOrFail();
$follow = new Follower(); if($actor->id == $target->id) {
$follow->profile_id = $actor->id; continue;
$follow->following_id = $target->id; }
$follow->save();
FollowPipeline::dispatch($follow); $follow = Follower::firstOrCreate([
'profile_id' => $actor->id,
'following_id' => $target->id
]);
if($follow->wasRecentlyCreated == true) {
FollowPipeline::dispatch($follow);
}
} catch (Exception $e) { } catch (Exception $e) {
continue; continue;
} }