Metadata解決処理をトランザクション内で実行する

This commit is contained in:
shibafu 2020-08-01 17:26:38 +09:00
parent 978d54cf12
commit f8a93fdf45

View File

@ -8,6 +8,7 @@ use App\MetadataResolver\MetadataResolver;
use App\Tag;
use App\Utilities\Formatter;
use GuzzleHttp\Exception\TransferException;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Log;
class MetadataResolveService
@ -33,6 +34,7 @@ class MetadataResolveService
throw new DeniedHostException($url);
}
return DB::transaction(function () use ($url) {
// 無かったら取得
// TODO: ある程度古かったら再取得とかありだと思う
$metadata = Metadata::find($url);
@ -60,5 +62,6 @@ class MetadataResolveService
}
return $metadata;
});
}
}