improving snap suggestions and pre-sorting

This commit is contained in:
Vinicius Moreira
2019-09-19 18:55:05 -03:00
parent a25c5875d5
commit 1e991cb55d
2 changed files with 4 additions and 0 deletions

View File

@@ -207,6 +207,7 @@ class FlatpakManager(SoftwareManager):
else: else:
break break
res.sort(key=lambda s: s.priority.value, reverse=True)
return res return res
def is_default_enabled(self) -> bool: def is_default_enabled(self) -> bool:

View File

@@ -1,3 +1,4 @@
import time
from datetime import datetime from datetime import datetime
from threading import Thread from threading import Thread
from typing import List, Set, Type from typing import List, Set, Type
@@ -163,12 +164,14 @@ class SnapManager(SoftwareManager):
t = Thread(target=self._fill_suggestion, args=(sug[0], sug[1], res)) t = Thread(target=self._fill_suggestion, args=(sug[0], sug[1], res))
t.start() t.start()
threads.append(t) threads.append(t)
time.sleep(0.001) # to avoid being blocked
else: else:
break break
for t in threads: for t in threads:
t.join() t.join()
res.sort(key=lambda s: s.priority.value, reverse=True)
return res return res
def is_default_enabled(self) -> bool: def is_default_enabled(self) -> bool: