Skip to content

Commit afacea9

Browse files
CopilotMte90
andcommitted
Fix embedding timeout logging and batch completion messages
- Add detailed error message when embedding API timeout occurs - Change batch completion message to show status (SUCCESS/PARTIAL/FAILED) - Add debug log when chunk is skipped due to no embedding vector Co-authored-by: Mte90 <403283+Mte90@users.noreply.github.com>
1 parent fae8c28 commit afacea9

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

ai/analyzer.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ def _process_file_sync(
210210
if embedding_duration > 5.0:
211211
logger.warning(f"Slow embedding API response for {rel_path} chunk {idx}: {embedding_duration:.2f}s total")
212212
except concurrent.futures.TimeoutError:
213-
logger.error(f"Embedding API timeout ({EMBEDDING_TIMEOUT}s) for {rel_path} chunk {idx}")
213+
logger.error(f"Embedding API timeout ({EMBEDDING_TIMEOUT}s) for {rel_path} chunk {idx} - The embedding request did not complete within {EMBEDDING_TIMEOUT}s. This may indicate network issues, API overload, or the chunk being too large.")
214214
emb = None
215215
failed_count += 1
216216
except Exception as e:
@@ -241,10 +241,13 @@ def _process_file_sync(
241241
print(err_content)
242242
except Exception:
243243
logger.exception("Failed to write chunk-insert error to disk for %s chunk %d", rel_path, idx)
244+
else:
245+
logger.debug(f"Skipping chunk {idx} for {rel_path} - no embedding vector available")
244246

245247
# Log batch completion with timing and status
246248
batch_duration = time.time() - batch_start_time
247-
logger.info(f"Completed batch {batch_num}/{num_batches} for {rel_path}: {saved_count} saved, {failed_count} failed, {batch_duration:.2f}s elapsed")
249+
batch_status = "FAILED" if failed_count > 0 and saved_count == 0 else ("PARTIAL" if failed_count > 0 else "SUCCESS")
250+
logger.info(f"Batch {batch_num}/{num_batches} for {rel_path} - Status: {batch_status} - {saved_count} saved, {failed_count} failed, {batch_duration:.2f}s elapsed")
248251

249252
return {"stored": True, "embedded": embedded_any, "skipped": False}
250253
except Exception:

0 commit comments

Comments
 (0)