Skip to content

Commit

Permalink
Harmony client changed from per request and instead will be cached as…
Browse files Browse the repository at this point in the history
… global variable and will not validate auth credentials on initialization.
  • Loading branch information
frankinspace committed Feb 12, 2025
1 parent b6695a3 commit e3de327
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased]
### Added
### Changed
- [issues/55](https://github.com/podaac/bignbit/issues/55): Harmony client changed from per request and instead will be cached as global variable and will not validate auth credentials on initialization.
### Deprecated
### Removed
### Fixed
Expand Down
7 changes: 6 additions & 1 deletion bignbit/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

ED_USER = ED_PASS = None
EDL_USER_TOKEN = {}
HARMONY_CLIENT = None
HARMONY_CLIENT: Client or None = None


def get_edl_creds() -> (str, str):
Expand Down Expand Up @@ -269,6 +269,11 @@ def get_harmony_client(environment_str: str) -> harmony.Client:
harmony_environ = Environment.PROD

global HARMONY_CLIENT # pylint: disable=W0603

# If we already have a client, but it's for a different environment, replace it with one configured for new environment.
if HARMONY_CLIENT and HARMONY_CLIENT.config.environment != harmony_environ:
HARMONY_CLIENT = None

if not HARMONY_CLIENT:
HARMONY_CLIENT = Client(
env=harmony_environ,
Expand Down

0 comments on commit e3de327

Please sign in to comment.