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

pull/2/head
Leonardo Galli 7 years ago
parent a9b244bf75
commit e77d9ce848

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

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

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

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

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

Loading…
Cancel
Save