forked from miguel456/rbrecruiter
Major changes - Vote system now finished
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Providers;
|
||||
|
||||
use GuzzleHttp\Exception\ConnectException;
|
||||
use Illuminate\Support\Facades\Cache;
|
||||
use Illuminate\Support\Facades\Http;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
@@ -32,8 +33,17 @@ class MojangStatusProvider extends ServiceProvider
|
||||
{
|
||||
Log::info("Mojang Status Provider: Mojang Status not found in the cache; Sending new request.");
|
||||
|
||||
$mcstatus = Http::get(config('general.urls.mojang.statuscheck'));
|
||||
Cache::put('mojang_status', base64_encode($mcstatus->body()), now()->addMinutes(60));
|
||||
try
|
||||
{
|
||||
$mcstatus = Http::get(config('general.urls.mojang.statuscheck'));
|
||||
Cache::put('mojang_status', base64_encode($mcstatus->body()), now()->addDays(3));
|
||||
}
|
||||
catch(ConnectException $connectException)
|
||||
{
|
||||
Log::critical('Could not connect to Mojang servers: Cannot check/refresh status', [
|
||||
'message' => $connectException->getMessage()
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
View::share('mcstatus', json_decode(base64_decode(Cache::get('mojang_status')), true));
|
||||
|
Reference in New Issue
Block a user