mirror of
https://github.com/jellyfin/jellyfin.git
synced 2025-07-31 14:33:54 -04:00
faster progress reporting during library scan
This commit is contained in:
parent
eb612bd303
commit
de038ac029
@ -653,7 +653,7 @@ namespace MediaBrowser.Controller.Entities
|
|||||||
{
|
{
|
||||||
var list = children.ToList();
|
var list = children.ToList();
|
||||||
|
|
||||||
var percentages = new ConcurrentDictionary<Guid, double>(list.Select(i => new KeyValuePair<Guid, double>(i.Item1.Id, 0)));
|
var percentages = new Dictionary<Guid, double>();
|
||||||
|
|
||||||
var tasks = new List<Task>();
|
var tasks = new List<Task>();
|
||||||
|
|
||||||
@ -695,24 +695,30 @@ namespace MediaBrowser.Controller.Entities
|
|||||||
|
|
||||||
innerProgress.RegisterAction(p =>
|
innerProgress.RegisterAction(p =>
|
||||||
{
|
{
|
||||||
percentages.TryUpdate(child.Id, p / 100, percentages[child.Id]);
|
lock (percentages)
|
||||||
|
{
|
||||||
|
percentages[child.Id] = p/100;
|
||||||
|
|
||||||
var percent = percentages.Values.Sum();
|
var percent = percentages.Values.Sum();
|
||||||
percent /= list.Count;
|
percent /= list.Count;
|
||||||
|
|
||||||
progress.Report((90 * percent) + 10);
|
progress.Report((90 * percent) + 10);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
await ((Folder)child).ValidateChildren(innerProgress, cancellationToken, recursive).ConfigureAwait(false);
|
await ((Folder)child).ValidateChildren(innerProgress, cancellationToken, recursive).ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
percentages.TryUpdate(child.Id, 1, percentages[child.Id]);
|
lock (percentages)
|
||||||
|
{
|
||||||
|
percentages[child.Id] = 1;
|
||||||
|
|
||||||
var percent = percentages.Values.Sum();
|
var percent = percentages.Values.Sum();
|
||||||
percent /= list.Count;
|
percent /= list.Count;
|
||||||
|
|
||||||
progress.Report((90 * percent) + 10);
|
progress.Report((90 * percent) + 10);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user