Update FederationController, fix double lock bug

This commit is contained in:
Daniel Supernault 2022-12-29 03:54:58 -07:00
parent de331f2b64
commit 9fcccca910
No known key found for this signature in database
GPG key ID: 0DEF1C662C9033F7

View file

@ -178,12 +178,6 @@ class FederationController extends Controller
} else if( isset($obj['type']) && in_array($obj['type'], ['Follow', 'Accept'])) { } else if( isset($obj['type']) && in_array($obj['type'], ['Follow', 'Accept'])) {
dispatch(new InboxValidator($username, $headers, $payload))->onQueue('follow'); dispatch(new InboxValidator($username, $headers, $payload))->onQueue('follow');
} else { } else {
$lockKey = 'pf:ap:user-inbox:activity:' . hash('sha256', $obj['id']);
if(Cache::get($lockKey) !== null) {
return;
}
Cache::put($lockKey, 1, 43200);
usleep(5000);
dispatch(new InboxValidator($username, $headers, $payload))->onQueue('high'); dispatch(new InboxValidator($username, $headers, $payload))->onQueue('high');
} }
return; return;