Permalink
Browse files

tweak timeout in processor

  • Loading branch information...
1 parent 5c2061a commit b00996831d272ebc6c6a3f0b2c8fbc2a1f374bb1 @thruflo committed Feb 24, 2010
Showing with 5 additions and 6 deletions.
  1. +5 −6 src/torque/processor.py
View
@@ -8,6 +8,7 @@
import logging
import math
+import socket
import time
import urllib2
@@ -142,8 +143,9 @@ def __init__(
self.finish_on_empty = finish_on_empty
else:
self.finish_on_empty = options.finish_on_empty
- self.request_timeout = request_timeout and request_timeout \
- or options.request_timeout
+ request_timeout = request_timeout and request_timeout or options.request_timeout
+ if request_timeout:
+ socket.setdefaulttimeout(request_timeout)
self.running = True
@@ -159,10 +161,7 @@ def _dispatch(self, url, params={}, decode=True):
a python object.
"""
- request = urllib2.Request(
- url,
- unicode_urlencode(params),
- timeout=self.request_timeout
+ request = urllib2.Request(url, unicode_urlencode(params)
)
response = None
try:

0 comments on commit b009968

Please sign in to comment.