File tree Expand file tree Collapse file tree 1 file changed +6
-3
lines changed
Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -50,9 +50,6 @@ impl EmbeddingApi {
5050 let max_retries = 5 ;
5151 let mut retries = 0 ;
5252 loop {
53- if retries > max_retries {
54- return Err ( EmbeddingError :: MaxRetriesExceeded ( max_retries) ) ;
55- }
5653 let res = self
5754 . client
5855 . post ( & self . cfg . url )
@@ -68,6 +65,9 @@ impl EmbeddingApi {
6865 if e. is_timeout ( ) {
6966 warn ! ( "Embedding API request timed out" ) ;
7067 retries += 1 ;
68+ if retries > max_retries {
69+ return Err ( EmbeddingError :: MaxRetriesExceeded ( max_retries) ) ;
70+ }
7171 tokio:: time:: sleep ( Duration :: from_secs ( 2_u64 . pow ( retries) ) ) . await ;
7272 continue ;
7373 }
@@ -83,6 +83,9 @@ impl EmbeddingApi {
8383 status, response_content
8484 ) ;
8585 retries += 1 ;
86+ if retries > max_retries {
87+ return Err ( EmbeddingError :: MaxRetriesExceeded ( max_retries) ) ;
88+ }
8689 tokio:: time:: sleep ( Duration :: from_secs ( 2_u64 . pow ( retries) ) ) . await ;
8790 continue ;
8891 }
You can’t perform that action at this time.
0 commit comments