mirror of
https://github.com/retspen/webvirtcloud
synced 2026-12-03 17:36:05 +00:00
fix(instances): a host that does not answer no longer holds the VM lists
The VM list and its poll read each host in turn. A host that is up but stuck (a daemon or an NFS mount that does not answer) kept the call waiting: the list did not open in 200 s (seen live with compute1's virtqemud stopped), and the per-host limit freed it only when gunicorn ended the request after 600 s. The list and the poll now ask all hosts at once, each in a thread counted on its host like a request, and wait 10 s at most: a host that has not answered is shown as not answering, and the VMs of the others are listed. Live: the list opens in 10 s, then in 5 s while the host stays stuck.
This commit is contained in:
parent
b65d2abaf6
commit
cf1f7ad055
9 changed files with 176 additions and 53 deletions
|
|
@ -157,6 +157,18 @@ def _count_on(connection):
|
|||
_request.held = connection
|
||||
|
||||
|
||||
@contextlib.contextmanager
|
||||
def counted_thread():
|
||||
"""A thread a web request starts to use a host counts as a request of its
|
||||
own (HOST_REQUESTS): one stuck on a host it asks holds a place there, and
|
||||
the next ones are refused, not piled up."""
|
||||
_request.active = True
|
||||
try:
|
||||
yield
|
||||
finally:
|
||||
_request_finished()
|
||||
|
||||
|
||||
@contextlib.contextmanager
|
||||
def other_hosts():
|
||||
"""For code that reads other hosts in the middle of a web request, which
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue