Skip to content

Commit

Permalink
Add error handling when trying to fetch lambda custom tags (#619)
Browse files Browse the repository at this point in the history
* Handle error when building lambda tags cache

* remove comments
  • Loading branch information
sabiurr authored Nov 14, 2022
1 parent ffef447 commit 016761f
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions aws/logs_monitoring/cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,10 +203,12 @@ def _refresh(self):
logger.debug("S3 cache expired, rebuilding cache")
lock_acquired = self.acquire_s3_cache_lock()
if lock_acquired:
success, tags_fetched = self.build_tags_cache()
success, new_tags_fetched = self.build_tags_cache()
if success:
self.tags_by_id = tags_fetched
self.tags_by_id = new_tags_fetched
self.write_cache_to_s3(self.tags_by_id)
elif tags_fetched != {}:
self.tags_by_id = tags_fetched

self.release_s3_cache_lock()
# s3 cache fetch succeeded and isn't expired
Expand Down Expand Up @@ -328,6 +330,7 @@ def build_tags_cache(self):
send_forwarder_internal_metrics(
"client_error", additional_tags=additional_tags
)
tags_fetch_success = False

logger.debug(
"Built this tags cache from GetResources API calls: %s", tags_by_arn_cache
Expand Down

0 comments on commit 016761f

Please sign in to comment.