Added: Last round of optimisation. Large libraries should load around 2x faster again compared to the last version.

This commit is contained in:
Leonardo Galli 2017-10-07 18:15:58 +02:00
parent a9b244bf75
commit e77d9ce848
5 changed files with 19 additions and 6 deletions

View File

@ -124,7 +124,7 @@ namespace NzbDrone.Api.REST
Get[ROOT_ROUTE] = options =>
{
var pagingSpec = ReadPagingResourceFromRequest();
if (pagingSpec.Page == 0 && pagingSpec.PageSize == 0)
if ((pagingSpec.Page == 0 && pagingSpec.PageSize == 0) || pagingSpec.PageSize == -1)
{
var all = GetResourceAll();
return all.AsResponse();

View File

@ -142,6 +142,9 @@ namespace NzbDrone.Core.Datastore
Mapper.Entity<Movie>().RegisterModel("Movies")
.Ignore(s => s.RootFolderPath)
.Ignore(m => m.Actors)
.Ignore(m => m.Genres)
.Ignore(m => m.Tags)
.Relationship()
.HasOne(s => s.Profile, s => s.ProfileId);
//.HasOne(m => m.MovieFile, m => m.MovieFileId);

View File

@ -72,11 +72,11 @@ namespace NzbDrone.Core.MediaCover
mediaCover.Url = _configFileProvider.UrlBase + @"/MediaCover/" + seriesId + "/" + mediaCover.CoverType.ToString().ToLower() + ".jpg";
if (_diskProvider.FileExists(filePath))
/*if (_diskProvider.FileExists(filePath))
{
var lastWrite = _diskProvider.FileGetLastWrite(filePath);
mediaCover.Url += "?lastWrite=" + lastWrite.Ticks;
}
}*/
}
}

View File

@ -3,7 +3,12 @@ var movieCollection = require('./MoviesCollection');
var fullCollection = movieCollection.clone();
fullCollection.reset();
fullCollection.bindSignalR();
fullCollection.state.pageSize = 100000;
fullCollection.state.pageSize = -1;
fullCollection.state.page = 0;
fullCollection.parseRecords = function(resp) {
return resp;
};
fullCollection.fetch({reset : true});
module.exports = fullCollection;

View File

@ -85,6 +85,11 @@ var Collection = PageableCollection.extend({
if (this.mode === 'client') {
return {};
}
if (this.state.pageSize == -1) {
return this.state;
}
var direction = -1;
if (resp.sortDirection.toLowerCase() === "descending") {
direction = 1;
@ -93,7 +98,7 @@ var Collection = PageableCollection.extend({
},
parseRecords : function(resp) {
if (resp && this.mode !== 'client') {
if (resp && this.mode !== 'client' && this.state.pageSize != 0 && this.state.pageSize != -1) {
return resp.records;
}
@ -247,7 +252,7 @@ var Collection = PageableCollection.extend({
},
add : function(model, options) {
if (this.length >= this.state.pageSize) {
if (this.length >= this.state.pageSize && this.state.pageSize != -1) {
return;
}
this.origAdd.call(this, model, options);