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 );
@@ -150,7 +152,8 @@ protected function requestMulti(
150152 array $ urls ,
151153 array $ headers = [],
152154 array $ bodies = [],
153- int $ timeout = 30
155+ int $ timeout = 30 ,
156+ int $ connectTimeout = 10
154157 ): array {
155158 if (empty ($ urls )) {
156159 throw new \Exception ('No URLs provided. Must provide at least one URL. ' );
@@ -187,6 +190,7 @@ protected function requestMulti(
187190 CURLOPT_FORBID_REUSE => false ,
188191 CURLOPT_FRESH_CONNECT => false ,
189192 CURLOPT_TIMEOUT => $ timeout ,
193+ CURLOPT_CONNECTTIMEOUT => $ connectTimeout ,
190194 ]);
191195
192196 $ urlCount = \count ($ urls );
You can’t perform that action at this time.
0 commit comments