File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -78,8 +78,9 @@ protected function request(
7878 string $ method ,
7979 string $ url ,
8080 array $ headers = [],
81- array $ body = null ,
82- int $ timeout = 30
81+ ?array $ body = null ,
82+ int $ timeout = 30 ,
83+ int $ connectTimeout = 10
8384 ): array {
8485 $ ch = \curl_init ();
8586
@@ -109,6 +110,7 @@ protected function request(
109110 CURLOPT_RETURNTRANSFER => true ,
110111 CURLOPT_USERAGENT => "Appwrite {$ this ->getName ()} Message Sender " ,
111112 CURLOPT_TIMEOUT => $ timeout ,
113+ CURLOPT_CONNECTTIMEOUT => $ connectTimeout ,
112114 ]);
113115
114116 $ response = \curl_exec ($ ch );
@@ -149,7 +151,8 @@ protected function requestMulti(
149151 array $ urls ,
150152 array $ headers = [],
151153 array $ bodies = [],
152- int $ timeout = 30
154+ int $ timeout = 30 ,
155+ int $ connectTimeout = 10
153156 ): array {
154157 if (empty ($ urls )) {
155158 throw new \Exception ('No URLs provided. Must provide at least one URL. ' );
@@ -186,6 +189,7 @@ protected function requestMulti(
186189 CURLOPT_FORBID_REUSE => false ,
187190 CURLOPT_FRESH_CONNECT => false ,
188191 CURLOPT_TIMEOUT => $ timeout ,
192+ CURLOPT_CONNECTTIMEOUT => $ connectTimeout ,
189193 ]);
190194
191195 $ urlCount = \count ($ urls );
You can’t perform that action at this time.
0 commit comments