Azure-Samples / chat-with-your-data-solution-accelerator

A Solution Accelerator for the RAG pattern running in Azure, using Azure AI Search for retrieval and Azure OpenAI large language models to power ChatGPT-style and Q&A experiences. This includes most common requirements and best practices.
https://azure.microsoft.com/products/search
MIT License
656 stars 327 forks source link

fix: EnvHelper unusable if error occurs during initialisation #954

Closed cecheta closed 1 month ago

cecheta commented 1 month ago

Purpose

Does this introduce a breaking change?

github-actions[bot] commented 1 month ago

Coverage

Coverage Report •
FileStmtsMissCoverMissing
code/backend/batch/utilities/helpers
   env_helper.py1351092%223, 228–229, 232–234, 246, 250–252
TOTAL242867272% 

Tests Skipped Failures Errors Time
206 0 :zzz: 0 :x: 0 :fire: 12.606s :stopwatch:
ross-p-smith commented 1 month ago

Not for this PR - but wonder whether the @functools.cache would be simpler than the lock

cecheta commented 1 month ago

Not for this PR - but wonder whether the @functools.cache would be simpler than the lock

From what I quickly saw online, there could be multiple threads trying to create EnvHelpers at the same time during startup unless we use a lock

I don't think that would break the application, but I guess it wouldn't be a true singleton