chore: remove watcher polling option (#7480)

* remove watcher polling

* fix lint

* add db migration
This commit is contained in:
Jonathan Jogenfors 2024-02-28 21:20:10 +01:00 committed by GitHub
parent 784d92dbb3
commit e4f32a045d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
14 changed files with 18 additions and 107 deletions

View file

@ -112,20 +112,13 @@ export class LibraryService extends EventEmitter {
ignore: library.exclusionPatterns,
});
const config = await this.configCore.getConfig();
const { usePolling, interval } = config.library.watch;
this.logger.debug(`Settings for watcher: usePolling: ${usePolling}, interval: ${interval}`);
let _resolve: () => void;
const ready$ = new Promise<void>((resolve) => (_resolve = resolve));
this.watchers[id] = this.storageRepository.watch(
library.importPaths,
{
usePolling,
interval,
binaryInterval: interval,
usePolling: false,
ignoreInitial: true,
},
{

View file

@ -1,12 +1,9 @@
import { validateCronExpression } from '@app/domain';
import { ApiProperty } from '@nestjs/swagger';
import { Type } from 'class-transformer';
import {
IsBoolean,
IsInt,
IsNotEmpty,
IsObject,
IsPositive,
IsString,
Validate,
ValidateIf,
@ -38,14 +35,6 @@ export class SystemConfigLibraryScanDto {
export class SystemConfigLibraryWatchDto {
@IsBoolean()
enabled!: boolean;
@IsBoolean()
usePolling!: boolean;
@IsInt()
@IsPositive()
@ApiProperty({ type: 'integer' })
interval!: number;
}
export class SystemConfigLibraryDto {

View file

@ -132,8 +132,6 @@ export const defaults = Object.freeze<SystemConfig>({
},
watch: {
enabled: false,
usePolling: false,
interval: 10_000,
},
},
server: {

View file

@ -136,8 +136,6 @@ const updatedConfig = Object.freeze<SystemConfig>({
},
watch: {
enabled: false,
usePolling: false,
interval: 10_000,
},
},
});

View file

@ -51,8 +51,6 @@ export enum SystemConfigKey {
LIBRARY_SCAN_CRON_EXPRESSION = 'library.scan.cronExpression',
LIBRARY_WATCH_ENABLED = 'library.watch.enabled',
LIBRARY_WATCH_USE_POLLING = 'library.watch.usePolling',
LIBRARY_WATCH_INTERVAL = 'library.watch.interval',
LOGGING_ENABLED = 'logging.enabled',
LOGGING_LEVEL = 'logging.level',
@ -268,8 +266,6 @@ export interface SystemConfig {
};
watch: {
enabled: boolean;
usePolling: boolean;
interval: number;
};
};
server: {

View file

@ -0,0 +1,12 @@
import { MigrationInterface, QueryRunner } from 'typeorm';
export class RemoveLibraryWatchPollingOption1709150004123 implements MigrationInterface {
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`DELETE FROM "system_config" WHERE key = 'library.watch.usePolling'`);
await queryRunner.query(`DELETE FROM "system_config" WHERE key = 'library.watch.interval'`);
}
public async down(): Promise<void> {
// noop
}
}