소스 검색

ignore the "Popped wrong app context" Assertion Error raised by AppContext

Son NK 5 년 전
부모
커밋
61a8f1e676
1개의 변경된 파일8개의 추가작업 그리고 4개의 파일을 삭제
  1. 8 4
      email_handler.py

+ 8 - 4
email_handler.py

@@ -1251,10 +1251,14 @@ class MailHandler:
             smtp = SMTP(POSTFIX_SERVER, POSTFIX_PORT or 25)
 
         app = new_app()
-        with app.app_context():
-            ret = await handle(envelope, smtp)
-            LOG.debug("takes %s seconds <<===", time.time() - start)
-            return ret
+        try:
+            with app.app_context():
+                ret = await handle(envelope, smtp)
+                LOG.debug("takes %s seconds <<===", time.time() - start)
+                return ret
+        # ignore the "Popped wrong app context" Assertion Error raised by AppContext
+        except AssertionError as e:
+            LOG.warning("Error %s", e)
 
 
 if __name__ == "__main__":