Improved owncloud quota monitor backend resiliance to connection errors

This commit is contained in:
Marc Aymerich 2016-10-03 09:04:56 +00:00
parent 5a8dfba893
commit 0b30e0e9dd
2 changed files with 6 additions and 7 deletions

View File

@ -467,9 +467,3 @@ with open(file) as handler:
# SAVE INISTIAL PASSWORD from all services, and just use it to create the service, never update it # SAVE INISTIAL PASSWORD from all services, and just use it to create the service, never update it
# Eliminar tots els serveis de l'account no elimina les factures, pero crec que queda pendent arreglar el missatge summary, perque allà diu que s'eliminaran N factures, xo no surten llistades a la llista d'objectes oi?
# Make owncloud quota backend more resilient to HTTP/connection errors

View File

@ -1,6 +1,7 @@
import re import re
import sys import sys
import textwrap import textwrap
import time
import xml.etree.ElementTree as ET import xml.etree.ElementTree as ET
from urllib.parse import urlparse from urllib.parse import urlparse
@ -159,7 +160,11 @@ class OwnCloudDiskQuota(OwnClouwAPIMixin, ServiceMonitor):
return replace(context, "'", '"') return replace(context, "'", '"')
def get_quota(self, saas, server): def get_quota(self, saas, server):
user = self.get_user(saas) try:
user = self.get_user(saas)
except requests.exceptions.ConnectionError:
time.sleep(2)
user = self.get_user(saas)
context = { context = {
'object_id': saas.pk, 'object_id': saas.pk,
'used': int(user['quota'].get('used', 0)), 'used': int(user['quota'].get('used', 0)),