84 def _get_requests(self):
85
86 requests = []
87
88
89 default_timeout = 0
90
91
92 for engineref in self.search_query.engineref_list:
93 processor = PROCESSORS[engineref.name]
94
95
96 if processor.extend_container_if_suspended(self.result_container):
97 continue
98
99
100 request_params = processor.get_params(self.search_query, engineref.category)
101 if request_params is None:
102 continue
103
104 counter_inc('engine', engineref.name, 'search', 'count', 'sent')
105
106
107 requests.append((engineref.name, self.search_query.query, request_params))
108
109
110 default_timeout = max(default_timeout, processor.engine.timeout)
111
112
113 max_request_timeout = settings['outgoing']['max_request_timeout']
114 actual_timeout = default_timeout
115 query_timeout = self.search_query.timeout_limit
116
117 if max_request_timeout is None and query_timeout is None:
118
119 pass
120 elif max_request_timeout is None and query_timeout is not None:
121
122 actual_timeout = min(default_timeout, query_timeout)
123 elif max_request_timeout is not None and query_timeout is None:
124
125 actual_timeout = min(default_timeout, max_request_timeout)
126 elif max_request_timeout is not None and query_timeout is not None:
127
128 actual_timeout = min(query_timeout, max_request_timeout)
129
130 logger.debug(
131 "actual_timeout={0} (default_timeout={1}, ?timeout_limit={2}, max_request_timeout={3})".format(
132 actual_timeout, default_timeout, query_timeout, max_request_timeout
133 )
134 )
135
136 return requests, actual_timeout
137