From eaa12036ca09994d63a1304175209dff4eebf4ae Mon Sep 17 00:00:00 2001 From: Tilman Oe Date: Thu, 16 Jan 2020 15:22:59 +0100 Subject: [PATCH] added try/except block so that method handles errors more sanely --- modules/file.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/modules/file.py b/modules/file.py index a3b4029..4586d74 100644 --- a/modules/file.py +++ b/modules/file.py @@ -458,8 +458,19 @@ def doCleanupDeletedFiles(cursor = None): else: if file["itercount"] > maxIterCount: logging.info("Finally deleting, %s" % file["dlkey"]) - blobstore.delete(file["dlkey"]) + + try: + blobstore.delete(file["dlkey"]) + + except blobstore.PermissionDeniedError: + logging.info("No permission to delete this file, ignoring") + + except Exception as e: + # logging.exception(e) + raise e + db.Delete(file.key()) + # There should be exactly 1 or 0 of these for f in db.Query("file").filter("dlkey =", file["dlkey"]).iter(keysOnly=True): db.Delete(f)