Skip to content

Commit

Permalink
Fix testing issue.
Browse files Browse the repository at this point in the history
  • Loading branch information
FledgeXu committed Aug 24, 2023
1 parent 8d3628c commit e6b6856
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions backend/api/s3.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,7 @@

class S3Storage:
def __init__(self) -> None:
self.storage = self._setup_s3_and_check_credentials(
constants.s3_url_with_credentials
)
self._storage = None

def _setup_s3_and_check_credentials(self, s3_url_with_credentials):
logger.info("testing S3 Optimization Cache credentials")
Expand All @@ -24,5 +22,13 @@ def _setup_s3_and_check_credentials(self, s3_url_with_credentials):
raise ValueError("Unable to connect to Optimization Cache. Check its URL.")
return s3_storage

@property
def storage(self):
if not self._storage:
self._storage = self._setup_s3_and_check_credentials(
constants.s3_url_with_credentials
)
return self._storage


s3_storage = S3Storage()

0 comments on commit e6b6856

Please sign in to comment.