Commit 94486be6 authored by Nicolas Wavrant's avatar Nicolas Wavrant

erp5_antivirus_clammit: limit the timeout to the time left to the zope transaction

parent f1a8f978
......@@ -28,6 +28,7 @@
from AccessControl import ClassSecurityInfo
from Products.ERP5Type import Permissions
from Products.ERP5Type.Timeout import getTimeLeft
from Products.ERP5Type.XMLObject import XMLObject
import requests
......@@ -50,7 +51,11 @@ class ClammitConnector(XMLObject):
def _request(*args, **kw):
return requests.request(*args, **kw)
kw.setdefault("timeout", self.getTimeout(self._DEFAULT_TIMEOUT))
timeout = kw.get("timeout", self.getTimeout(self._DEFAULT_TIMEOUT))
kw['timeout'] = min(
getTimeLeft() or timeout,
timeout,
)
ca_certificate = self.getCertificateAuthorityCertificate()
if ca_certificate:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment