|
|
|
@ -346,7 +346,20 @@ class Helpers {
|
|
|
|
|
$reply_to = null;
|
|
|
|
|
}
|
|
|
|
|
$ts = is_array($res['published']) ? $res['published'][0] : $res['published'];
|
|
|
|
|
$status = DB::transaction(function() use($profile, $res, $url, $ts, $reply_to, $cw, $scope, $id) {
|
|
|
|
|
|
|
|
|
|
$statusLockKey = 'helpers:status-lock:' . hash('sha256', $res['id']);
|
|
|
|
|
$status = Cache::lock($statusLockKey)
|
|
|
|
|
->get(function () use(
|
|
|
|
|
$profile,
|
|
|
|
|
$res,
|
|
|
|
|
$url,
|
|
|
|
|
$ts,
|
|
|
|
|
$reply_to,
|
|
|
|
|
$cw,
|
|
|
|
|
$scope,
|
|
|
|
|
$id
|
|
|
|
|
) {
|
|
|
|
|
return DB::transaction(function() use($profile, $res, $url, $ts, $reply_to, $cw, $scope, $id) {
|
|
|
|
|
$status = new Status;
|
|
|
|
|
$status->profile_id = $profile->id;
|
|
|
|
|
$status->url = isset($res['url']) ? $res['url'] : $url;
|
|
|
|
@ -368,6 +381,7 @@ class Helpers {
|
|
|
|
|
}
|
|
|
|
|
return $status;
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
return $status;
|
|
|
|
|
}
|
|
|
|
@ -458,7 +472,9 @@ class Helpers {
|
|
|
|
|
|
|
|
|
|
$profile = Profile::whereRemoteUrl($res['id'])->first();
|
|
|
|
|
if(!$profile) {
|
|
|
|
|
$profile = DB::transaction(function() use($domain, $webfinger, $res, $runJobs) {
|
|
|
|
|
$profileLockKey = 'helpers:profile-lock:' . hash('sha256', $res['id']);
|
|
|
|
|
$profile = Cache::lock($profileLockKey)->get(function () use($domain, $webfinger, $res, $runJobs) {
|
|
|
|
|
return DB::transaction(function() use($domain, $webfinger, $res, $runJobs) {
|
|
|
|
|
$profile = new Profile();
|
|
|
|
|
$profile->domain = strtolower($domain);
|
|
|
|
|
$profile->username = strtolower(Purify::clean($webfinger));
|
|
|
|
@ -478,6 +494,7 @@ class Helpers {
|
|
|
|
|
}
|
|
|
|
|
return $profile;
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
} else {
|
|
|
|
|
// Update info after 24 hours
|
|
|
|
|
if($profile->last_fetched_at == null ||
|
|
|
|
|