You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Not only summary; this needs to be done by far more robust.
Since we expect in copr that even over hundred or two of clients might be concurrently
waiting for ticket resolution, we can not keep that many connections open. That said,
the ticket-wait is basically useless for copr. We could, though, do something like:
actively wait on server for say 5 seconds if the ticket gets resolved that fast or not
fallback to polling
opt-in client side polling
The wake-up delivery is not robust either. The worst case scenario is that
the wake-up even is lost and the ticket-wait waits another 10s.
diff --git a/resallocserver/api.py b/resallocserver/api.py
index d4bcfe3..20108cd 100644
--- a/resallocserver/api.py+++ b/resallocserver/api.py@@ -84,18 +84,19 @@ class ServerAPI(object):
with session_scope() as session:
ticket = session.query(models.Ticket).get(ticket_id)
+ if ticket.resource:+ return ticket.resource.data
ticket.tid = self.my_id()
session.add(ticket)
while True:
- with session_scope() as session:- ticket = session.query(models.Ticket).get(ticket_id)- if ticket.resource:- return ticket.resource.data-
with self.sync.resource_ready:
+ with session_scope() as session:+ ticket = session.query(models.Ticket).get(ticket_id)+ if ticket.resource:+ return ticket.resource.data
while self.sync.resource_ready.wait(timeout=10):
- if self.sync.tid==self.my_id():+ if self.sync.tid == self.my_id():
break
diff --git a/resallocserver/manager.py b/resallocserver/manager.py
index 42ac5b9..288c226 100644
--- a/resallocserver/manager.py+++ b/resallocserver/manager.py@@ -489,8 +489,8 @@ class Manager(object):
self.sync = sync
def _notify_waiting(self, thread_id):
- self.sync.tid = thread_id
with self.sync.resource_ready:
+ self.sync.tid = thread_id
self.sync.resource_ready.notify_all()
def _assign_tickets(self):
ssia
The text was updated successfully, but these errors were encountered: