Skip to content

Commit 300e36f

Browse files
authored
Merge pull request #2961 from rtibbles/user_storage
First pass fix for non-existent users being passed to the calculate user storage task
2 parents deb4663 + 9a5601a commit 300e36f

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

contentcuration/contentcuration/tasks.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -272,9 +272,12 @@ def generatenodediff_task(updated_id, original_id):
272272

273273
@task(name="calculate_user_storage_task")
274274
def calculate_user_storage_task(user_id):
275-
user = User.objects.get(pk=user_id)
276-
user.set_space_used()
277-
cache.delete(CACHE_USER_STORAGE_KEY.format(user_id))
275+
try:
276+
user = User.objects.get(pk=user_id)
277+
user.set_space_used()
278+
cache.delete(CACHE_USER_STORAGE_KEY.format(user_id))
279+
except User.DoesNotExist:
280+
logging.error("Tried to calculate user storage for user with id {} but they do not exist".format(user_id))
278281

279282

280283
@task(name="sendcustomemails_task")

0 commit comments

Comments
 (0)