Skip to content
Snippets Groups Projects
Commit 6ab93f68 authored by Fabrice Le Goff's avatar Fabrice Le Goff
Browse files

set timeout for DdmMonitoringThread's operations

parent 3a0e41b5
No related branches found
No related tags found
No related merge requests found
Pipeline #586035 passed
......@@ -66,7 +66,7 @@ class DdmMonitoringThread(threading.Thread):
try:
req = urllib2.Request(self.conf.DdmMonitoringEndpoint)
req.add_header('Content-Type', 'application/json')
urllib2.urlopen(req, json.dumps(data))
urllib2.urlopen(req, json.dumps(data), timeout=self.conf.DdmMonitoringTimeout)
self.logger.debug('published entry for %s: %s',
data['filename'], json.dumps(data))
......@@ -85,7 +85,12 @@ class DdmMonitoringThread(threading.Thread):
else:
self.logger.debug('will retry to publish data for %s',
data['filename'])
self.DdmMonitoringQueue.put(data)
try:
self.DdmMonitoringQueue.put(data, block=True,
timeout=self.conf.DdmMonitoringTimeout)
except Queue.Full:
self.logger.warning('could not put entry back in the queue for %s: '
'timeout, queue is full', data['filename'])
if self.requestErrorSince is None:
self.requestErrorSince = time.time()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment