chat-with-your-data-solution-accelerator
chat-with-your-data-solution-accelerator copied to clipboard
fix: EnvHelper unusable if error occurs during initialisation
Purpose
- If an error occurs during env helper initialisation, the helper remains in a non-working state until the app restarts. This PR fixes this, so the env helper is only saved if it is created without any errors
Does this introduce a breaking change?
- [ ] Yes
- [x] No
| Tests | Skipped | Failures | Errors | Time |
|---|---|---|---|---|
| 206 | 0 :zzz: | 0 :x: | 0 :fire: | 12.606s :stopwatch: |
Not for this PR - but wonder whether the @functools.cache would be simpler than the lock
Not for this PR - but wonder whether the
@functools.cachewould 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