Yes, that’s what I think so too.
I’ve created this test to highlight the issue a bit better:
import requests
from concurrent.futures import as_completed
from requests_futures.sessions import FuturesSession
def run_parallel_requests(url, max_requests = 30):
with FuturesSession() as rsess:
# run one first
print(list(as_completed([rsess.get(url)]))[0].result()._content)
# and then run the rest
futures = [rsess.get(url) for i in range(max_requests-1)]
for future in as_completed(futures):
response = future.result()
print(response._content)
url = "http://localhost:8000/mysess"
max_requests = 30
run_parallel_requests(url, max_requests)
Running with “django.contrib.sessions.backends.file” and --nothreading (works as expected):
>>> run_parallel_requests(url, max_requests)
b"Hello, world. You're at the polls index. Counter = 1"
b"Hello, world. You're at the polls index. Counter = 2"
b"Hello, world. You're at the polls index. Counter = 3"
b"Hello, world. You're at the polls index. Counter = 4"
b"Hello, world. You're at the polls index. Counter = 5"
b"Hello, world. You're at the polls index. Counter = 6"
b"Hello, world. You're at the polls index. Counter = 7"
b"Hello, world. You're at the polls index. Counter = 8"
b"Hello, world. You're at the polls index. Counter = 9"
b"Hello, world. You're at the polls index. Counter = 10"
b"Hello, world. You're at the polls index. Counter = 11"
b"Hello, world. You're at the polls index. Counter = 12"
b"Hello, world. You're at the polls index. Counter = 13"
b"Hello, world. You're at the polls index. Counter = 14"
b"Hello, world. You're at the polls index. Counter = 15"
b"Hello, world. You're at the polls index. Counter = 16"
b"Hello, world. You're at the polls index. Counter = 17"
b"Hello, world. You're at the polls index. Counter = 18"
b"Hello, world. You're at the polls index. Counter = 19"
b"Hello, world. You're at the polls index. Counter = 20"
b"Hello, world. You're at the polls index. Counter = 21"
b"Hello, world. You're at the polls index. Counter = 22"
b"Hello, world. You're at the polls index. Counter = 23"
b"Hello, world. You're at the polls index. Counter = 24"
b"Hello, world. You're at the polls index. Counter = 25"
b"Hello, world. You're at the polls index. Counter = 26"
b"Hello, world. You're at the polls index. Counter = 27"
b"Hello, world. You're at the polls index. Counter = 28"
b"Hello, world. You're at the polls index. Counter = 29"
b"Hello, world. You're at the polls index. Counter = 30"
And without --nothreading (does not work as expected):
>>> run_parallel_requests(url, max_requests)
b"Hello, world. You're at the polls index. Counter = 1"
b"Hello, world. You're at the polls index. Counter = 2"
b"Hello, world. You're at the polls index. Counter = 3"
b"Hello, world. You're at the polls index. Counter = 3"
b"Hello, world. You're at the polls index. Counter = 3"
b"Hello, world. You're at the polls index. Counter = 3"
b"Hello, world. You're at the polls index. Counter = 3"
b"Hello, world. You're at the polls index. Counter = 3"
b"Hello, world. You're at the polls index. Counter = 3"
b"Hello, world. You're at the polls index. Counter = 3"
b"Hello, world. You're at the polls index. Counter = 1"
b"Hello, world. You're at the polls index. Counter = 1"
b"Hello, world. You're at the polls index. Counter = 1"
b"Hello, world. You're at the polls index. Counter = 1"
b"Hello, world. You're at the polls index. Counter = 1"
b"Hello, world. You're at the polls index. Counter = 1"
b"Hello, world. You're at the polls index. Counter = 1"
b"Hello, world. You're at the polls index. Counter = 1"
b"Hello, world. You're at the polls index. Counter = 1"
b"Hello, world. You're at the polls index. Counter = 1"
b"Hello, world. You're at the polls index. Counter = 1"
b"Hello, world. You're at the polls index. Counter = 1"
b"Hello, world. You're at the polls index. Counter = 1"
b"Hello, world. You're at the polls index. Counter = 1"
b"Hello, world. You're at the polls index. Counter = 2"
b"Hello, world. You're at the polls index. Counter = 2"
b"Hello, world. You're at the polls index. Counter = 1"
b"Hello, world. You're at the polls index. Counter = 2"
b"Hello, world. You're at the polls index. Counter = 2"
b"Hello, world. You're at the polls index. Counter = 2"
I am going to try it on Linux shortly.