File tree Expand file tree Collapse file tree 1 file changed +21
-0
lines changed
Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Original file line number Diff line number Diff line change 1313use Illuminate \Queue \InteractsWithQueue ;
1414use Illuminate \Queue \SerializesModels ;
1515use Illuminate \Support \Arr ;
16+ use Illuminate \Support \Facades \Http ;
1617use Symfony \Component \Process \Exception \ProcessFailedException ;
1718use Symfony \Component \Process \Process ;
1819
@@ -41,6 +42,26 @@ public function __construct(
4142 */
4243 public function handle (): void
4344 {
45+ /**
46+ * Check to make sure there is an internet connection first.
47+ */
48+ try {
49+ Http::retry (3 , 500 )->get ('https://google.com ' );
50+ } catch (\Throwable $ th ) {
51+ $ this ->result ->update ([
52+ 'data ' => [
53+ 'type ' => 'log ' ,
54+ 'level ' => 'error ' ,
55+ 'message ' => 'Could not resolve host. ' ,
56+ ],
57+ 'status ' => ResultStatus::Failed,
58+ ]);
59+
60+ SpeedtestFailed::dispatch ($ this ->result );
61+
62+ return ;
63+ }
64+
4465 $ options = array_filter ([
4566 'speedtest ' ,
4667 '--accept-license ' ,
You can’t perform that action at this time.
0 commit comments