Skip to content

Commit

Permalink
Merge pull request RedHatInsights#1132 from petracihalova/rbac-prod-m…
Browse files Browse the repository at this point in the history
…ax-seed-threads-fix

temporary logs for debugging the purge_cache() issue
  • Loading branch information
petracihalova authored Jun 27, 2024
2 parents 8fcc495 + 5d440b2 commit 5a71008
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 10 deletions.
11 changes: 5 additions & 6 deletions rbac/management/cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -197,17 +197,16 @@ def delete_all_policies_for_tenant(self):
logger.info("Deleting entire policy cache for tenant %s", self.tenant)
try:
key = self.key_for("*")
logger.info("value of key", key)
logger.info(f"value of key: {key}")
except Exception as e:
logger.error('error from key = self.key_for("*")', e)
raise e
logger.error(f'error from key = self.key_for("*") with error message: {e}')

keys = []
try:
keys = self.connection.keys(key)
logger.info(f"Content of 'keys' variable: {keys}")
except Exception as e:
logger.error("error from keys = self.connection.keys(key)", e)
raise e
logger.error(f"error from keys = self.connection.keys(key): {e}")

if keys:
try:
Expand All @@ -217,7 +216,7 @@ def delete_all_policies_for_tenant(self):
f"An exception occurred inside delete_all_policies_for_tenant() for tenant {self.tenant} "
f"withing line 'if keys': {e}"
)
raise e

logger.info(f"End of 'with self.delete_handler' for tenant {self.tenant}")
logger.info(f"End of 'delete_all_policies_for_tenant' for tenant {self.tenant}")

Expand Down
5 changes: 1 addition & 4 deletions rbac/management/seeds.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,19 +31,17 @@ def on_complete(progress, tenant):
cache = AccessCache(tenant.org_id)
except Exception as e:
logger.error(f"An exception occurred inside on_complete() for line 1: {e}")
raise e

try:
cache.delete_all_policies_for_tenant()
except Exception as e:
logger.error(f"An exception occurred inside on_complete() for line 2: {e}")
raise e

try:
connections.close_all()
except Exception as e:
logger.error(f"An exception occurred inside on_complete() for line 3: {e}")
raise e

logger.info(f"Finished purging policy cache for tenant {tenant.org_id} [{progress}].")


Expand Down Expand Up @@ -92,4 +90,3 @@ def purge_cache():
executor.submit(on_complete, progress, tenant)
except Exception as e:
logger.error(f"An exception occurred inside purge_cache() for {tenant}: {e}")
raise e

0 comments on commit 5a71008

Please sign in to comment.