Merge pull request #452 from shikorism/fix/451-atomic-metadata-resolve
Metadata解決処理をトランザクション内で実行する
This commit is contained in:
commit
a63c39a56f
@ -8,6 +8,7 @@ use App\MetadataResolver\MetadataResolver;
|
|||||||
use App\Tag;
|
use App\Tag;
|
||||||
use App\Utilities\Formatter;
|
use App\Utilities\Formatter;
|
||||||
use GuzzleHttp\Exception\TransferException;
|
use GuzzleHttp\Exception\TransferException;
|
||||||
|
use Illuminate\Support\Facades\DB;
|
||||||
use Illuminate\Support\Facades\Log;
|
use Illuminate\Support\Facades\Log;
|
||||||
|
|
||||||
class MetadataResolveService
|
class MetadataResolveService
|
||||||
@ -33,6 +34,7 @@ class MetadataResolveService
|
|||||||
throw new DeniedHostException($url);
|
throw new DeniedHostException($url);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return DB::transaction(function () use ($url) {
|
||||||
// 無かったら取得
|
// 無かったら取得
|
||||||
// TODO: ある程度古かったら再取得とかありだと思う
|
// TODO: ある程度古かったら再取得とかありだと思う
|
||||||
$metadata = Metadata::find($url);
|
$metadata = Metadata::find($url);
|
||||||
@ -60,5 +62,6 @@ class MetadataResolveService
|
|||||||
}
|
}
|
||||||
|
|
||||||
return $metadata;
|
return $metadata;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user