Skip to content

Commit 47cef8c

Browse files
alanbchristieAlan Christie
and
Alan Christie
authored
Reduced security logging (#605)
* refactor: Adds extra logging in proposal extraction * style: Initial cache now a set rather than empty list * fix: Fix cache collection failure logic * fix: Reduced logging for proposal cache --------- Co-authored-by: Alan Christie <alan.christie@matildapeak.com>
1 parent 392d1bf commit 47cef8c

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

api/security.py

+5-8
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ def has_expired(username) -> bool:
5353
# Expired, reset the expiry time
5454
CachedContent._timers[username] = now + CachedContent._cache_period
5555
if has_expired:
56-
logger.info("Content expired for '%s'", username)
56+
logger.debug("Content expired for '%s'", username)
5757
return has_expired
5858

5959
@staticmethod
@@ -62,14 +62,14 @@ def get_content(username):
6262
if username not in CachedContent._content:
6363
CachedContent._content[username] = set()
6464
content = CachedContent._content[username]
65-
logger.info("Got content for '%s': %s", username, content)
65+
logger.debug("Got content for '%s': %s", username, content)
6666
return content
6767

6868
@staticmethod
6969
def set_content(username, content) -> None:
7070
with CachedContent._cache_lock:
7171
CachedContent._content[username] = content.copy()
72-
logger.info("Set content for '%s': %s", username, content)
72+
logger.debug("Set content for '%s': %s", username, content)
7373

7474

7575
def get_remote_conn(force_error_display=False) -> Optional[SSHConnector]:
@@ -246,7 +246,6 @@ def _run_query_with_connector(self, conn, user):
246246

247247
def _get_proposals_for_user_from_ispyb(self, user):
248248
if CachedContent.has_expired(user.username):
249-
logger.info("Cache has expired for '%s'", user.username)
250249
PrometheusMetrics.new_proposal_cache_miss()
251250
if conn := get_configured_connector():
252251
logger.info("Got a connector for '%s'", user.username)
@@ -260,13 +259,11 @@ def _get_proposals_for_user_from_ispyb(self, user):
260259
# Return what we have for the user. Public (open) proposals
261260
# will be added to what we return if necessary.
262261
cached_prop_ids = CachedContent.get_content(user.username)
263-
logger.debug(
264-
"Have %s cached Proposals for '%s': %s",
262+
logger.info(
263+
"Returning %s cached Proposals for '%s'",
265264
len(cached_prop_ids),
266265
user.username,
267-
cached_prop_ids,
268266
)
269-
270267
return cached_prop_ids
271268

272269
def _get_proposals_from_connector(self, user, conn):

0 commit comments

Comments
 (0)