Ensure we don't create a job for a node that's already being loaded

This commit is contained in:
Dave Pearson
2023-05-11 09:16:54 +01:00
parent ce7a78db69
commit 791f2ea189

View File

@@ -316,10 +316,12 @@ class DirectoryTree(Tree[DirEntry]):
except Empty:
# Queue is empty; our work here is done.
return
# We've got a new directory load job, add it to the collection
# of running jobs and kick off the load.
self._running_load_jobs.add(new_job.id)
self._load_directory(new_job)
# At this point we've got a new directory load job; add it to
# the collection of running jobs and kick off the load, but only
# if there isn't already a job for it.
if not new_job.id in self._running_load_jobs:
self._running_load_jobs.add(new_job.id)
self._load_directory(new_job)
def _on_directory_tree__load_finished(
self, event: DirectoryTree._LoadFinished