Przeglądaj źródła

Update Move pipeline, add debug logging

Daniel Supernault 10 miesięcy temu
rodzic
commit
5558535aea

+ 5 - 0
app/Jobs/MovePipeline/ProcessMovePipeline.php

@@ -9,6 +9,7 @@ use Illuminate\Foundation\Queue\Queueable;
 use Illuminate\Queue\Middleware\ThrottlesExceptions;
 use Illuminate\Queue\Middleware\ThrottlesExceptions;
 use Illuminate\Queue\Middleware\WithoutOverlapping;
 use Illuminate\Queue\Middleware\WithoutOverlapping;
 use DateTime;
 use DateTime;
+use Log;
 
 
 class ProcessMovePipeline implements ShouldQueue
 class ProcessMovePipeline implements ShouldQueue
 {
 {
@@ -86,11 +87,13 @@ class ProcessMovePipeline implements ShouldQueue
         $res = ActivityPubFetchService::fetchRequest($this->target, true);
         $res = ActivityPubFetchService::fetchRequest($this->target, true);
 
 
         if (! $res || ! isset($res['alsoKnownAs'])) {
         if (! $res || ! isset($res['alsoKnownAs'])) {
+            Log::info('[AP][INBOX][MOVE] target_aka failure');
             return false;
             return false;
         }
         }
 
 
         $res = Helpers::profileFetch($this->target);
         $res = Helpers::profileFetch($this->target);
         if (! $res) {
         if (! $res) {
+            Log::info('[AP][INBOX][MOVE] target fetch failure');
             return false;
             return false;
         }
         }
 
 
@@ -112,11 +115,13 @@ class ProcessMovePipeline implements ShouldQueue
         $res = ActivityPubFetchService::fetchRequest($this->actor, true);
         $res = ActivityPubFetchService::fetchRequest($this->actor, true);
 
 
         if (! $res || ! isset($res['movedTo'])) {
         if (! $res || ! isset($res['movedTo'])) {
+            Log::info('[AP][INBOX][MOVE] actor_movedTo failure');
             return false;
             return false;
         }
         }
 
 
         $res = Helpers::profileFetch($this->actor);
         $res = Helpers::profileFetch($this->actor);
         if (! $res) {
         if (! $res) {
+            Log::info('[AP][INBOX][MOVE] actor fetch failure');
             return false;
             return false;
         }
         }
 
 

+ 2 - 2
app/Util/ActivityPub/Inbox.php

@@ -145,7 +145,6 @@ class Inbox
             case 'Move':
             case 'Move':
                 if (MoveValidator::validate($this->payload) == false) {
                 if (MoveValidator::validate($this->payload) == false) {
                     \Log::info('[AP][INBOX][MOVE] VALIDATE_FAILURE '.json_encode($this->payload));
                     \Log::info('[AP][INBOX][MOVE] VALIDATE_FAILURE '.json_encode($this->payload));
-
                     return;
                     return;
                 }
                 }
                 $this->handleMoveActivity();
                 $this->handleMoveActivity();
@@ -1367,6 +1366,7 @@ class Inbox
             ! Helpers::validateUrl($activity) ||
             ! Helpers::validateUrl($activity) ||
             ! Helpers::validateUrl($target)
             ! Helpers::validateUrl($target)
         ) {
         ) {
+            \Log::info('[AP][INBOX][MOVE] validateUrl fail');
             return;
             return;
         }
         }
 
 
@@ -1375,6 +1375,6 @@ class Inbox
             new MoveMigrateFollowersPipeline($target, $activity),
             new MoveMigrateFollowersPipeline($target, $activity),
             new UnfollowLegacyAccountMovePipeline($target, $activity),
             new UnfollowLegacyAccountMovePipeline($target, $activity),
             new CleanupLegacyAccountMovePipeline($target, $activity),
             new CleanupLegacyAccountMovePipeline($target, $activity),
-        ])->onQueue('move')->dispatch();
+        ])->onQueue('move')->dispatchSync();
     }
     }
 }
 }