Merge branch 'develop'
This commit is contained in:
commit
908790b53d
@ -44,7 +44,7 @@ class HomeController extends Controller
|
|||||||
->orderBy('ejaculations.ejaculated_date', 'desc')
|
->orderBy('ejaculations.ejaculated_date', 'desc')
|
||||||
->select('ejaculations.*')
|
->select('ejaculations.*')
|
||||||
->with('user', 'tags')
|
->with('user', 'tags')
|
||||||
->take(5)
|
->take(10)
|
||||||
->get();
|
->get();
|
||||||
|
|
||||||
return view('home')->with(compact('informations', 'categories', 'publicLinkedEjaculations'));
|
return view('home')->with(compact('informations', 'categories', 'publicLinkedEjaculations'));
|
||||||
|
@ -6,8 +6,10 @@ use App\Events\LinkDiscovered;
|
|||||||
use App\Metadata;
|
use App\Metadata;
|
||||||
use App\MetadataResolver\MetadataResolver;
|
use App\MetadataResolver\MetadataResolver;
|
||||||
use App\Utilities\Formatter;
|
use App\Utilities\Formatter;
|
||||||
|
use GuzzleHttp\Exception\TransferException;
|
||||||
use Illuminate\Queue\InteractsWithQueue;
|
use Illuminate\Queue\InteractsWithQueue;
|
||||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||||
|
use Illuminate\Support\Facades\Log;
|
||||||
|
|
||||||
class LinkCollector
|
class LinkCollector
|
||||||
{
|
{
|
||||||
@ -42,13 +44,19 @@ class LinkCollector
|
|||||||
// TODO: ある程度古かったら再取得とかありだと思う
|
// TODO: ある程度古かったら再取得とかありだと思う
|
||||||
$metadata = Metadata::find($url);
|
$metadata = Metadata::find($url);
|
||||||
if ($metadata == null) {
|
if ($metadata == null) {
|
||||||
$resolved = $this->metadataResolver->resolve($url);
|
try {
|
||||||
Metadata::create([
|
$resolved = $this->metadataResolver->resolve($url);
|
||||||
'url' => $url,
|
Metadata::create([
|
||||||
'title' => $resolved->title,
|
'url' => $url,
|
||||||
'description' => $resolved->description,
|
'title' => $resolved->title,
|
||||||
'image' => $resolved->image
|
'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