Fix issue with jobs occasionally showing for the wrong server

This commit is contained in:
Brett Williams
2023-06-03 15:02:41 -05:00
parent c4280d95da
commit 7dc7f17f83

View File

@@ -29,10 +29,6 @@ def make_sortable(tree):
tree.heading(col, text=col, command=lambda c=col: sort_column(tree, c)) tree.heading(col, text=col, command=lambda c=col: sort_column(tree, c))
def available_servers():
return [socket.gethostname()]
class DashboardWindow: class DashboardWindow:
lib_path = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) lib_path = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
@@ -238,7 +234,10 @@ class DashboardWindow:
tree.item(item, values=new_values, tags=tags) tree.item(item, values=new_values, tags=tags)
break break
hostname = self.server_proxy.hostname
job_fetch = self.server_proxy.get_jobs() job_fetch = self.server_proxy.get_jobs()
# have to check hostname is still valid because of delay in fetching jobs
if hostname == self.server_proxy.hostname:
if job_fetch is not None: if job_fetch is not None:
if len(job_fetch) < len(self.job_cache) or len(job_fetch) == 0: if len(job_fetch) < len(self.job_cache) or len(job_fetch) == 0:
self.job_tree.delete(*self.job_tree.get_children()) self.job_tree.delete(*self.job_tree.get_children())
@@ -279,6 +278,10 @@ class DashboardWindow:
def start_client(): def start_client():
logging.basicConfig(format='%(asctime)s: %(levelname)s: %(module)s: %(message)s', datefmt='%d-%b-%y %H:%M:%S',
level='INFO'.upper())
x = DashboardWindow() x = DashboardWindow()
x.mainloop() x.mainloop()