update for both tabs only when visible

master^2
papuSpartan 2024-09-19 01:16:36 -05:00
parent 8ac2b3c190
commit f5331b0bdb
No known key found for this signature in database
GPG Key ID: CA376082283AF69A
2 changed files with 8 additions and 5 deletions

View File

@ -6,8 +6,14 @@ function confirm_restart_workers(_) {
// live updates // live updates
function update() { function update() {
try { try {
let refresh_button = document.getElementById('distributed-refresh-status') let currentTab = get_uiCurrentTabContent()
refresh_button.click() let buttons = document.querySelectorAll('#distributed-refresh-status')
for(let i = 0; i < buttons.length; i++) {
if(currentTab.contains(buttons[i])) {
buttons[i].click()
break
}
}
} catch (e) { } catch (e) {
if (!(e instanceof TypeError)) { if (!(e instanceof TypeError)) {
throw e throw e

View File

@ -103,7 +103,6 @@ class World:
def __repr__(self): def __repr__(self):
return f"{len(self._workers)} workers" return f"{len(self._workers)} workers"
def default_batch_size(self) -> int: def default_batch_size(self) -> int:
"""the amount of images/total images requested that a worker would compute if conditions were perfect and """the amount of images/total images requested that a worker would compute if conditions were perfect and
each worker generated at the same speed. assumes one batch only""" each worker generated at the same speed. assumes one batch only"""
@ -393,7 +392,6 @@ class World:
self.initialized = True self.initialized = True
logger.debug("world initialized!") logger.debug("world initialized!")
def get_workers(self): def get_workers(self):
filtered: List[Worker] = [] filtered: List[Worker] = []
for worker in self._workers: for worker in self._workers:
@ -753,7 +751,6 @@ class World:
for worker in self._workers: for worker in self._workers:
worker.restart() worker.restart()
def inject_model_dropdown_handler(self): def inject_model_dropdown_handler(self):
if self.config().get('enabled', False): # TODO avoid access from config() if self.config().get('enabled', False): # TODO avoid access from config()
return return