Merge branch 'develop'
This commit is contained in:
commit
908790b53d
@ -44,7 +44,7 @@ class HomeController extends Controller
|
||||
->orderBy('ejaculations.ejaculated_date', 'desc')
|
||||
->select('ejaculations.*')
|
||||
->with('user', 'tags')
|
||||
->take(5)
|
||||
->take(10)
|
||||
->get();
|
||||
|
||||
return view('home')->with(compact('informations', 'categories', 'publicLinkedEjaculations'));
|
||||
|
@ -6,8 +6,10 @@ use App\Events\LinkDiscovered;
|
||||
use App\Metadata;
|
||||
use App\MetadataResolver\MetadataResolver;
|
||||
use App\Utilities\Formatter;
|
||||
use GuzzleHttp\Exception\TransferException;
|
||||
use Illuminate\Queue\InteractsWithQueue;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
class LinkCollector
|
||||
{
|
||||
@ -42,6 +44,7 @@ class LinkCollector
|
||||
// TODO: ある程度古かったら再取得とかありだと思う
|
||||
$metadata = Metadata::find($url);
|
||||
if ($metadata == null) {
|
||||
try {
|
||||
$resolved = $this->metadataResolver->resolve($url);
|
||||
Metadata::create([
|
||||
'url' => $url,
|
||||
@ -49,6 +52,11 @@ class LinkCollector
|
||||
'description' => $resolved->description,
|
||||
'image' => $resolved->image
|
||||
]);
|
||||
} catch (TransferException $e) {
|
||||
// 何らかの通信エラーによってメタデータの取得に失敗した時、とりあえずエラーログにURLを残す
|
||||
Log::error(self::class . ': メタデータの取得に失敗 URL=' . $url);
|
||||
report($e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user