Various fixes

- Improved pipeline performance
- Improver importer progress
- Steam API slow down to not get 429-ed
(but still allow bursts on smaller steam libraries)
This commit is contained in:
GeoffreyCoulaud
2023-06-04 02:45:52 +02:00
parent 7d8a7a894f
commit ebd22e27da
3 changed files with 18 additions and 5 deletions

View File

@@ -30,7 +30,7 @@ class Pipeline(GObject.Object):
@property
def is_done(self) -> bool:
return len(self.not_done) == 0
return len(self.waiting) == 0 and len(self.running) == 0
@property
def blocked(self) -> set[Manager]:
@@ -49,6 +49,17 @@ class Pipeline(GObject.Object):
"""Get the managers that can be run"""
return self.waiting - self.blocked
@property
def progress(self) -> float:
"""Get the pipeline progress. Should only be a rough idea."""
n_done = len(self.done)
n_total = len(self.waiting) + len(self.running) + n_done
try:
progress = n_done / n_total
except ZeroDivisionError:
progress = 1
return progress
def advance(self):
"""Spawn tasks for managers that are able to run for a game"""