Fix the prev commit

This commit is contained in:
Vadim Ushakov 2021-10-23 21:40:41 +07:00
parent 1b68182a76
commit fe24e17baa

View file

@ -291,7 +291,7 @@ class FileServer(ConnectionServer):
if self.isInternetOnline(): if self.isInternetOnline():
break break
if len(self.update_pool) == 0: if len(self.update_pool) == 0:
thread = self.update_pool.spawn(self.updateRandomSite) thread = self.thread_pool.spawn(self.updateRandomSite)
thread.join() thread.join()
self.recheckPort() self.recheckPort()
@ -330,13 +330,14 @@ class FileServer(ConnectionServer):
while True: while True:
restart = False restart = False
for thread in list(iter(self.update_pool)): for thread in list(iter(self.update_pool)):
if not thread.site_address: thread_site_address = getattr(thread, 'site_address', None)
if not thread_site_address:
# Possible race condition in assigning thread.site_address in spawnUpdateSite() # Possible race condition in assigning thread.site_address in spawnUpdateSite()
# Trying again. # Trying again.
self.sleep(0.1) self.sleep(0.1)
restart = True restart = True
break break
if thread.site_address == site_address: if thread_site_address == site_address:
return True return True
if not restart: if not restart:
return False return False
@ -397,6 +398,7 @@ class FileServer(ConnectionServer):
sites_processed += 1 sites_processed += 1
log.info("running <update> for %s" % site.address_short)
thread = self.spawnUpdateSite(site) thread = self.spawnUpdateSite(site)
if not self.isActiveMode(): if not self.isActiveMode():