Skip to content

Commit

Permalink
Don't require history to calculate anon disk usage
Browse files Browse the repository at this point in the history
This is probably the simplest way to fix the anon user issue.
If we don't have a history the size is 0, that's fairly simple.

We might still want to do galaxyproject#17755
for those FastAPI endpoints that do actually require a default history.
  • Loading branch information
mvdbeek committed Mar 16, 2024
1 parent 3ebf8eb commit a20c3de
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions lib/galaxy/webapps/galaxy/services/users.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,10 +122,9 @@ def get_user(self, trans: ProvidesUserContext, user_id):
def _anon_user_api_value(self, trans: ProvidesHistoryContext):
"""Return data for an anonymous user, truncated to only usage and quota_percent"""
if not trans.user and not trans.history:
# Can't return info about this user, may not have a history yet.
# return {}
raise glx_exceptions.MessageException(err_msg="The user has no history, which should always be the case.")
usage = self.quota_agent.get_usage(trans, history=trans.history)
usage = None
else:
usage = self.quota_agent.get_usage(trans, history=trans.history)
percent = self.quota_agent.get_percent(trans=trans, usage=usage)
usage = usage or 0
return {
Expand Down

0 comments on commit a20c3de

Please sign in to comment.