Skip to content

Commit

Permalink
changing to a thread pool of size 1 to avoid AWS throttling
Browse files Browse the repository at this point in the history
  • Loading branch information
brifordwylie committed Dec 11, 2023
1 parent 7b4db5b commit e146fa9
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/sageworks/aws_service_broker/aws_service_broker.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ def __class_init__(cls, database_scope):
cls.fresh_cache = SageWorksCache(expire=60, postfix=":fresh")

# Thread Pool for Refreshes
cls.thread_pool = ThreadPoolExecutor(max_workers=1) # 1 thread to do data refreshes, bunch of threads = AWS Throttling
cls.thread_pool = ThreadPoolExecutor(max_workers=1) # 1 thread for data refreshes, bunch of threads = AWS Throttling

# This connection map sets up the connector objects for each category of metadata
# Note: Even though this seems confusing, it makes other code WAY simpler
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ def sageworks_meta_via_arn(self, arn: str) -> dict:
# Note: AWS List Tags can get grumpy if called too often
self.log.debug(f"Calling list_tags AWS request {arn}...")
try:
time.sleep(0.5) # Sleep for 0.5 seconds to avoid throttling
time.sleep(0.25) # Sleep for 0.25 seconds to avoid throttling
aws_tags = self.sm_session.list_tags(arn)
except botocore.exceptions.ClientError as e:
error_code = e.response["Error"]["Code"]
Expand Down

0 comments on commit e146fa9

Please sign in to comment.