Added some optimalizations
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Pünkösd Marcell 2020-10-23 18:21:39 +02:00
parent 2910c0a2e2
commit 127fb1144d

View File

@ -36,9 +36,13 @@ def independent_worker(result_queue, filename: str, timeout: float, target_url:
prepared_curl.setopt(pycurl.URL, target_url) prepared_curl.setopt(pycurl.URL, target_url)
prepared_curl.setopt(pycurl.SSL_VERIFYPEER, 0) prepared_curl.setopt(pycurl.SSL_VERIFYPEER, 0)
prepared_curl.setopt(pycurl.SSL_VERIFYHOST, 0) prepared_curl.setopt(pycurl.SSL_VERIFYHOST, 0)
prepared_curl.setopt(pycurl.SSL_VERIFYSTATUS, 0)
# prepared_curl.setopt(pycurl.FORBID_REUSE, 0) # prepared_curl.setopt(pycurl.FORBID_REUSE, 0)
prepared_curl.setopt(pycurl.HTTP_VERSION, pycurl.CURL_HTTP_VERSION_2_0) prepared_curl.setopt(pycurl.HTTP_VERSION, pycurl.CURL_HTTP_VERSION_2_0)
prepared_curl.setopt(pycurl.WRITEFUNCTION, lambda _: None) prepared_curl.setopt(pycurl.WRITEFUNCTION, lambda _: None)
prepared_curl.setopt(pycurl.NOSIGNAL, 1)
prepared_curl.setopt(pycurl.TCP_FASTOPEN, 1)
prepared_curl.setopt(pycurl.MAXCONNECTS, 500) # this does not change much, as we use only one connection per worker
completed_jobs_list = blist() # O(log n) insert instead of python's O(n) completed_jobs_list = blist() # O(log n) insert instead of python's O(n)
@ -51,6 +55,7 @@ def independent_worker(result_queue, filename: str, timeout: float, target_url:
jobid = random.randint(0, 2147483647) jobid = random.randint(0, 2147483647)
prepared_curl.setopt(pycurl.HTTPPOST, [ prepared_curl.setopt(pycurl.HTTPPOST, [
('file', ( ('file', (
pycurl.FORM_CONTENTTYPE, 'audio/wave',
pycurl.FORM_FILE, filename # Copying buffers from Python memory would be even slower... trust me pycurl.FORM_FILE, filename # Copying buffers from Python memory would be even slower... trust me
)), )),
('description', ( ('description', (