forked from mirror/pixelfed
Update DeleteWorker, remove cache lock
This commit is contained in:
parent
61f230aa9e
commit
6d6a033a54
|
@ -72,39 +72,31 @@ class DeleteWorker implements ShouldQueue
|
||||||
'b:' . base64_encode($actor) :
|
'b:' . base64_encode($actor) :
|
||||||
'h:' . hash('sha256', $actor);
|
'h:' . hash('sha256', $actor);
|
||||||
|
|
||||||
$lockKey = 'ap:inbox:actor-delete-exists:lock:' . $hash;
|
$key = 'ap:inbox:actor-delete-exists:' . $hash;
|
||||||
Cache::lock($lockKey, 30)->block(15, function () use(
|
$actorDelete = Cache::remember($key, now()->addMinutes(15), function() use($actor) {
|
||||||
$headers,
|
return Profile::whereRemoteUrl($actor)
|
||||||
$payload,
|
->whereNotNull('domain')
|
||||||
$actor,
|
->exists();
|
||||||
$hash
|
});
|
||||||
) {
|
if($actorDelete) {
|
||||||
$key = 'ap:inbox:actor-delete-exists:' . $hash;
|
if($this->verifySignature($headers, $payload) == true) {
|
||||||
$actorDelete = Cache::remember($key, now()->addMinutes(15), function() use($actor) {
|
Cache::set($key, false);
|
||||||
return Profile::whereRemoteUrl($actor)
|
$profile = Profile::whereNotNull('domain')
|
||||||
->whereNotNull('domain')
|
->whereNull('status')
|
||||||
->exists();
|
->whereRemoteUrl($actor)
|
||||||
});
|
->first();
|
||||||
if($actorDelete) {
|
if($profile) {
|
||||||
if($this->verifySignature($headers, $payload) == true) {
|
DeleteRemoteProfilePipeline::dispatch($profile)->onQueue('delete');
|
||||||
Cache::set($key, false);
|
|
||||||
$profile = Profile::whereNotNull('domain')
|
|
||||||
->whereNull('status')
|
|
||||||
->whereRemoteUrl($actor)
|
|
||||||
->first();
|
|
||||||
if($profile) {
|
|
||||||
DeleteRemoteProfilePipeline::dispatch($profile)->onQueue('delete');
|
|
||||||
}
|
|
||||||
return 1;
|
|
||||||
} else {
|
|
||||||
// Signature verification failed, exit.
|
|
||||||
return 1;
|
|
||||||
}
|
}
|
||||||
|
return 1;
|
||||||
} else {
|
} else {
|
||||||
// Remote user doesn't exist, exit early.
|
// Signature verification failed, exit.
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
});
|
} else {
|
||||||
|
// Remote user doesn't exist, exit early.
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue