1
0
mirror of https://github.com/bpatrik/pigallery2.git synced 2025-07-17 01:32:29 +02:00

Improving config cloning performance #569

This commit is contained in:
Patrik J. Braun
2023-01-04 23:07:50 +01:00
parent b7584dbc85
commit a902cdcdfc
8 changed files with 29 additions and 31 deletions

14
package-lock.json generated
View File

@ -27,7 +27,7 @@
"sharp": "0.31.2", "sharp": "0.31.2",
"ts-exif-parser": "0.2.2", "ts-exif-parser": "0.2.2",
"ts-node-iptc": "1.0.11", "ts-node-iptc": "1.0.11",
"typeconfig": "2.0.29", "typeconfig": "2.0.32",
"typeorm": "0.3.10", "typeorm": "0.3.10",
"xml2js": "0.4.23" "xml2js": "0.4.23"
}, },
@ -20825,9 +20825,9 @@
} }
}, },
"node_modules/typeconfig": { "node_modules/typeconfig": {
"version": "2.0.29", "version": "2.0.32",
"resolved": "https://registry.npmjs.org/typeconfig/-/typeconfig-2.0.29.tgz", "resolved": "https://registry.npmjs.org/typeconfig/-/typeconfig-2.0.32.tgz",
"integrity": "sha512-0eQ4QkRUTxG1sy6aFuQV/uxpFamFShhdVQFVkMqhLUpNCAcgNS8VJkY4ZxVp09RnDdoR+L/Oj/3f655XyeNcPQ==", "integrity": "sha512-hbdt3SG0q9Sv6aqPMdmubY/513YokbiLRpqiAOY1HgaROTTw+3QdqYh4uKBoeKVHFgGgT66zBu1tyUkU8xO1lA==",
"dependencies": { "dependencies": {
"minimist": "1.2.7" "minimist": "1.2.7"
} }
@ -38126,9 +38126,9 @@
} }
}, },
"typeconfig": { "typeconfig": {
"version": "2.0.29", "version": "2.0.32",
"resolved": "https://registry.npmjs.org/typeconfig/-/typeconfig-2.0.29.tgz", "resolved": "https://registry.npmjs.org/typeconfig/-/typeconfig-2.0.32.tgz",
"integrity": "sha512-0eQ4QkRUTxG1sy6aFuQV/uxpFamFShhdVQFVkMqhLUpNCAcgNS8VJkY4ZxVp09RnDdoR+L/Oj/3f655XyeNcPQ==", "integrity": "sha512-hbdt3SG0q9Sv6aqPMdmubY/513YokbiLRpqiAOY1HgaROTTw+3QdqYh4uKBoeKVHFgGgT66zBu1tyUkU8xO1lA==",
"requires": { "requires": {
"minimist": "1.2.7" "minimist": "1.2.7"
} }

View File

@ -49,7 +49,7 @@
"sharp": "0.31.2", "sharp": "0.31.2",
"ts-exif-parser": "0.2.2", "ts-exif-parser": "0.2.2",
"ts-node-iptc": "1.0.11", "ts-node-iptc": "1.0.11",
"typeconfig": "2.0.29", "typeconfig": "2.0.32",
"xml2js": "0.4.23", "xml2js": "0.4.23",
"typeorm": "0.3.10" "typeorm": "0.3.10"
}, },

View File

@ -612,13 +612,18 @@ export class ServerJobConfig {
description: $localize`Jobs load this many photos or videos form the DB for processing at once.` description: $localize`Jobs load this many photos or videos form the DB for processing at once.`
}) })
mediaProcessingBatchSize: number = 1000; mediaProcessingBatchSize: number = 1000;
@ConfigProperty({arrayType: JobScheduleConfig}) @ConfigProperty({
arrayType: JobScheduleConfig,
tags: {
name: $localize`Scheduled jobs`,
priority: ConfigPriority.advanced}
})
scheduled: JobScheduleConfig[] = [ scheduled: JobScheduleConfig[] = [
new JobScheduleConfig( new JobScheduleConfig(
DefaultsJobs[DefaultsJobs.Indexing], DefaultsJobs[DefaultsJobs.Indexing],
DefaultsJobs[DefaultsJobs.Indexing], DefaultsJobs[DefaultsJobs.Indexing],
new NeverJobTriggerConfig(), new NeverJobTriggerConfig(),
{indexChangesOnly: true} // set config explicitly so it is not undefined on the UI {indexChangesOnly: true} // set config explicitly, so it is not undefined on the UI
), ),
new JobScheduleConfig( new JobScheduleConfig(
DefaultsJobs[DefaultsJobs['Preview Filling']], DefaultsJobs[DefaultsJobs['Preview Filling']],

View File

@ -3,19 +3,10 @@ import 'reflect-metadata';
import {ServerConfig} from './PrivateConfig'; import {ServerConfig} from './PrivateConfig';
import {WebConfigClass} from 'typeconfig/web'; import {WebConfigClass} from 'typeconfig/web';
import {ConfigState} from 'typeconfig/common'; import {ConfigState} from 'typeconfig/common';
import {WebConfigClassBuilder} from '../../../../node_modules/typeconfig/src/decorators/builders/WebConfigClassBuilder';
import {IWebConfigClassPrivate} from '../../../../node_modules/typeconfig/src/decorators/class/IWebConfigClass';
import {TAGS} from '../public/ClientConfig';
@WebConfigClass({softReadonly: true}) @WebConfigClass({softReadonly: true})
export class WebConfig extends ServerConfig { export class WebConfig extends ServerConfig {
@ConfigState() @ConfigState()
State: any; State: any;
clone(): IWebConfigClassPrivate<TAGS> & WebConfig {
const wcg = WebConfigClassBuilder.attachPrivateInterface(new WebConfig());
wcg.load(WebConfigClassBuilder.attachPrivateInterface(this).toJSON());
return wcg;
}
} }

View File

@ -482,11 +482,10 @@ export class ClientGalleryConfig {
}) })
enableOnScrollThumbnailPrioritising: boolean = true; enableOnScrollThumbnailPrioritising: boolean = true;
@ConfigProperty({ @ConfigProperty({
type: NavBarConfig,
tags: { tags: {
name: $localize`Navigation bar`, name: $localize`Navigation bar`,
priority: ConfigPriority.advanced, priority: ConfigPriority.advanced,
} } as TAGS
}) })
NavBar: NavBarConfig = new NavBarConfig(); NavBar: NavBarConfig = new NavBarConfig();
@ConfigProperty({ @ConfigProperty({

View File

@ -7,7 +7,6 @@ import {NavigationService} from '../../model/navigation.service';
import {PageHelper} from '../../model/page.helper'; import {PageHelper} from '../../model/page.helper';
import {SettingsService} from '../settings/settings.service'; import {SettingsService} from '../settings/settings.service';
import {ConfigPriority} from '../../../../common/config/public/ClientConfig'; import {ConfigPriority} from '../../../../common/config/public/ClientConfig';
import {Utils} from '../../../../common/Utils';
import {WebConfig} from '../../../../common/config/private/WebConfig'; import {WebConfig} from '../../../../common/config/private/WebConfig';
import {ISettingsComponent} from '../settings/template/ISettingsComponent'; import {ISettingsComponent} from '../settings/template/ISettingsComponent';
import {WebConfigClassBuilder} from '../../../../../node_modules/typeconfig/src/decorators/builders/WebConfigClassBuilder'; import {WebConfigClassBuilder} from '../../../../../node_modules/typeconfig/src/decorators/builders/WebConfigClassBuilder';

View File

@ -83,8 +83,9 @@ export class SettingsEntryComponent
for (const k of Object.keys(this.state.value[i].__state)) { for (const k of Object.keys(this.state.value[i].__state)) {
if (!Utils.equalsFilter( if (!Utils.equalsFilter(
this.state.value[i]?.__state[k]?.value, this.state.value[i]?.__state[k]?.value,
this.state.default[i]?.__state[k]?.value, this.state.default[i] ? this.state.default[i][k] : undefined,
['default', '__propPath', '__created', '__prototype', '__rootConfig'])) { ['default', '__propPath', '__created', '__prototype', '__rootConfig'])) {
return true; return true;
} }
} }

View File

@ -1,4 +1,4 @@
import {Component, Input, OnDestroy, OnInit, ViewChild} from '@angular/core'; import {Component, Input, OnChanges, OnDestroy, OnInit, ViewChild} from '@angular/core';
import {AuthenticationService} from '../../../model/network/authentication.service'; import {AuthenticationService} from '../../../model/network/authentication.service';
import {NavigationService} from '../../../model/navigation.service'; import {NavigationService} from '../../../model/navigation.service';
import {NotificationService} from '../../../model/notification.service'; import {NotificationService} from '../../../model/notification.service';
@ -55,7 +55,7 @@ export interface RecursiveState extends ConfigState {
templateUrl: './template.component.html', templateUrl: './template.component.html',
styleUrls: ['./template.component.css'] styleUrls: ['./template.component.css']
}) })
export class TemplateComponent implements OnInit, OnDestroy, ISettingsComponent { export class TemplateComponent implements OnInit, OnChanges, OnDestroy, ISettingsComponent {
public icon: string; public icon: string;
@Input() ConfigPath: string; @Input() ConfigPath: string;
@ -83,6 +83,14 @@ export class TemplateComponent implements OnInit, OnDestroy, ISettingsComponent
) { ) {
} }
ngOnChanges(): void {
if (!this.ConfigPath) {
this.setSliceFN(c => ({value: c as any, isConfigType: true, type: WebConfig} as any));
} else {
this.setSliceFN(c => c.__state[this.ConfigPath]);
}
this.name = this.states.tags?.name || this.ConfigPath;
}
ngOnInit(): void { ngOnInit(): void {
@ -100,12 +108,7 @@ export class TemplateComponent implements OnInit, OnDestroy, ISettingsComponent
this.onOptionChange(); this.onOptionChange();
}); });
if (!this.ConfigPath) {
this.setSliceFN(c => ({value: c as any, isConfigType: true, type: WebConfig} as any));
} else {
this.setSliceFN(c => c.__state[this.ConfigPath]);
}
this.name = this.states.tags?.name || this.ConfigPath;
} }