改进 模块 http 请求部分

This commit is contained in:
iVampireSP.com 2022-12-05 12:35:32 +08:00
parent b6a87a81c4
commit be342580a4
No known key found for this signature in database
GPG Key ID: 2F7B001CA27A8132
2 changed files with 2 additions and 3 deletions

View File

@ -10,7 +10,6 @@
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Queue\SerializesModels;
use Illuminate\Support\Facades\Cache;
use Illuminate\Support\Facades\Http;
use Illuminate\Support\Facades\Log;
class FetchModule implements ShouldQueue
@ -52,7 +51,7 @@ public function handle()
try {
$response = $module->http()->get('remote');
} catch (ConnectException $e) {
Log::error($e->getMessage());
Log::error('无法连接到模块:' . $module->name, ['error', $e->getMessage()]);
continue;
}

View File

@ -177,7 +177,7 @@ public function check($module_id = null): bool
public function http(): PendingRequest
{
return Http::module($this->api_token, $this->url)->acceptJson();
return Http::module($this->api_token, $this->url)->acceptJson()->timeout(5);
}
#[ArrayShape(['transactions' => "array"])]