[snap] caching categories to the disk | not locking the application boot while categories are being retrieved

This commit is contained in:
Vinicius Moreira
2019-10-22 16:36:10 -03:00
parent 930308834b
commit c358d077be
6 changed files with 82 additions and 26 deletions

View File

@@ -198,8 +198,7 @@ class AURCategoriesMapper(Thread):
self.logger.info('Loaded categories for {} AUR packages'.format(len(categories_map)))
if self.disk_cache and categories_map:
t = Thread(target=self._cache_categories_to_disk, args=(res.text,), daemon=True)
t.start()
Thread(target=self._cache_categories_to_disk, args=(res.text,), daemon=True).start()
return categories_map
except:
@@ -218,5 +217,6 @@ class AURCategoriesMapper(Thread):
if categories:
self.logger.info("Settings categories to {}".format(self.manager.__class__.__name__))
self.manager.categories_map = categories
self.logger.info('Finished')
self.manager.categories = categories
self.logger.info('Finished')