chat-with-your-data-solution-accelerator icon indicating copy to clipboard operation
chat-with-your-data-solution-accelerator copied to clipboard

fix: EnvHelper unusable if error occurs during initialisation

Open cecheta opened this issue 1 year ago • 2 comments

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

cecheta avatar May 20 '24 16:05 cecheta

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:

github-actions[bot] avatar May 20 '24 16:05 github-actions[bot]

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

ross-p-smith avatar May 20 '24 16:05 ross-p-smith

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

cecheta avatar May 21 '24 08:05 cecheta