Jelajahi Sumber

优化IOS推送异常打印

locky 3 bulan lalu
induk
melakukan
47664097f1
1 mengubah file dengan 4 tambahan dan 2 penghapusan
  1. 4 2
      Service/PushService.py

+ 4 - 2
Service/PushService.py

@@ -138,10 +138,12 @@ class PushObject:
                                     mutable_content=True)
             n = apns2.Notification(payload=payload, priority=apns2.PRIORITY_LOW)
             res = cli.push(n=n, device_token=token_val, topic=app_bundle_id)
-            assert res.status_code == 200 or res.status_code == 410
+            if res.status_code != 200 and res.status_code != 410:
+                LOGGER.info('{}IOS推送响应异常: 状态码: {}'.format(uid, res.status_code))
             return True
         except Exception as e:
-            LOGGER.info('IOS推送异常: {}, 证书路径: {}'.format(repr(e), pem_path))
+            LOGGER.info('{}IOS推送异常:{},错误行数:{},证书路径: {}'.
+                        format(uid, repr(e), e.__traceback__.tb_lineno, pem_path))
             return False
 
     @staticmethod