Add new queuing features to @futurize

- max_instances renamed to max_running

- consider_args parameter:
  if True, $max_running of this function with the same arguments can be
  running, else:
  $max_running of this function, no matter the arguments, can be running

- discard_if_max_running:
  if True and there are already the maximum possible number of running
  functions running, cancel this task (previous default behavior), else:
  Wait for a spot to be free before running
This commit is contained in:
miruka
2019-05-08 10:22:52 -04:00
parent 0bd98a321d
commit d08f43e6be
4 changed files with 68 additions and 27 deletions

View File

@@ -60,7 +60,7 @@ class Backend(QObject):
@pyqtSlot(str, result="QVariant")
@pyqtSlot(str, bool, result="QVariant")
@futurize()
@futurize(max_running=1, consider_args=True)
def getUserDisplayName(self, user_id: str, can_block: bool = True) -> str:
if user_id in self._queried_displaynames:
return self._queried_displaynames[user_id]