This repository was archived by the owner on Apr 9, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +9
-7
lines changed
Expand file tree Collapse file tree 1 file changed +9
-7
lines changed Original file line number Diff line number Diff line change @@ -182,7 +182,10 @@ impl RequestLogger {
182182 self . processing . lock ( ) . await . push ( pending. remove ( index) ) ;
183183 }
184184
185- async fn lookup_ips ( & self , ips : & [ String ] ) -> HashMap < String , ( String , String ) > {
185+ async fn lookup_ips (
186+ & self ,
187+ ips : & [ String ] ,
188+ ) -> Result < HashMap < String , ( String , String ) > , reqwest:: Error > {
186189 let mut result = HashMap :: new ( ) ;
187190
188191 let data = reqwest:: Client :: new ( )
@@ -200,11 +203,9 @@ impl RequestLogger {
200203 . collect :: < Vec < _ > > ( ) ,
201204 )
202205 . send ( )
203- . await
204- . unwrap ( )
206+ . await ?
205207 . json :: < Vec < serde_json:: Value > > ( )
206- . await
207- . unwrap ( ) ;
208+ . await ?;
208209
209210 for entry in data {
210211 if entry. get ( "continentCode" ) . is_none ( ) || entry. get ( "countryCode" ) . is_none ( ) {
@@ -220,7 +221,7 @@ impl RequestLogger {
220221 ) ;
221222 }
222223
223- result
224+ Ok ( result)
224225 }
225226
226227 pub async fn process ( & self ) {
@@ -243,7 +244,8 @@ impl RequestLogger {
243244 . collect :: < Vec < _ > > ( )
244245 . as_slice ( ) ,
245246 )
246- . await ;
247+ . await
248+ . unwrap_or_default ( ) ;
247249
248250 for r in requests. iter_mut ( ) {
249251 if let Some ( ( continent, country) ) = ips. get ( & r. ip . to_string ( ) ) {
You can’t perform that action at this time.
0 commit comments