1212using Flurl . Http ;
1313using Kantan . Net . Utilities ;
1414using Kantan . Text ;
15+ using Microsoft . Extensions . Logging ;
1516using SmartImage . Lib . Results ;
1617using SmartImage . Lib . Utilities ;
1718
@@ -34,7 +35,7 @@ protected IqdbEngine(string b, string e) : base(b, e)
3435 {
3536 MaxSize = MAX_FILE_SIZE ; // NOTE: assuming IQDB uses kilobytes instead of kibibytes
3637
37- // Timeout = TimeSpan.FromSeconds(10 );
38+ Timeout = TimeSpan . FromSeconds ( 30 ) ;
3839 }
3940
4041 private const int MAX_FILE_SIZE = 8_388_608 ;
@@ -54,7 +55,7 @@ private async Task<IDocument> GetDocumentAsync(SearchQuery query, CancellationTo
5455 IDocument document = null ;
5556
5657 try {
57- var response = await Client . Request ( EndpointUrl )
58+ /* var response = await Client.Request(EndpointUrl)
5859 .OnError(r =>
5960 {
6061 Debug.WriteLine($"{r.Exception}", Name);
@@ -73,8 +74,22 @@ private async Task<IDocument> GetDocumentAsync(SearchQuery query, CancellationTo
7374 }
7475
7576 return;
76- } , cancellationToken : ct ) ;
77-
77+ }, cancellationToken: ct);*/
78+ var response = await Client . Request ( URL_QUERY )
79+ . OnError ( r =>
80+ {
81+ // Debug.WriteLine($"{r.Exception}", Name);
82+ // r.ExceptionHandled = true;
83+ Logger . LogError ( r . Exception , $ "{ Name } ") ;
84+ Debugger . Break ( ) ;
85+ #if ! DEBUG
86+ r . ExceptionHandled = true ;
87+ #endif
88+ }
89+ )
90+ . SetQueryParam ( "url" , query . Upload )
91+ . WithTimeout ( Timeout )
92+ . GetAsync ( cancellationToken : ct ) ;
7893 if ( response != null ) {
7994 var s = await response . GetStringAsync ( ) ;
8095
0 commit comments