From 1c9e2a08aaa67e027c1b75a6a9c826cf3085549d Mon Sep 17 00:00:00 2001 From: "Patrik J. Braun" Date: Tue, 8 Aug 2023 23:56:38 +0200 Subject: [PATCH] Fix types --- src/backend/model/threading/ThreadPool.ts | 36 +++++++++-------------- src/backend/model/threading/Worker.ts | 16 +++++----- 2 files changed, 22 insertions(+), 30 deletions(-) diff --git a/src/backend/model/threading/ThreadPool.ts b/src/backend/model/threading/ThreadPool.ts index 1ec95c09..9d07500f 100644 --- a/src/backend/model/threading/ThreadPool.ts +++ b/src/backend/model/threading/ThreadPool.ts @@ -1,18 +1,11 @@ import * as cluster from 'cluster'; -import { Worker } from 'cluster'; -import { Logger } from '../../Logger'; -import { - DiskManagerTask, - ThumbnailTask, - WorkerMessage, - WorkerTask, - WorkerTaskTypes, -} from './Worker'; -import { ParentDirectoryDTO } from '../../../common/entities/DirectoryDTO'; -import { RendererInput } from './PhotoWorker'; -import { TaskQue, TaskQueEntry } from './TaskQue'; -import { ITaskExecuter } from './TaskExecuter'; -import { DirectoryScanSettings } from './DiskMangerWorker'; +import {Worker} from 'cluster'; +import {Logger} from '../../Logger'; +import {DiskManagerTask, WorkerMessage, WorkerTask, WorkerTaskTypes,} from './Worker'; +import {ParentDirectoryDTO} from '../../../common/entities/DirectoryDTO'; +import {TaskQue, TaskQueEntry} from './TaskQue'; +import {ITaskExecuter} from './TaskExecuter'; +import {DirectoryScanSettings} from './DiskMangerWorker'; interface WorkerWrapper { worker: Worker; @@ -81,12 +74,12 @@ export class ThreadPool { Logger.warn( LOG_TAG, 'Worker ' + - worker.worker.process.pid + - ' died with code: ' + - code + - ', and signal: ' + - signal + - ', worker count:', + worker.worker.process.pid + + ' died with code: ' + + code + + ', and signal: ' + + signal + + ', worker count:', ThreadPool.WorkerCount ); Logger.debug(LOG_TAG, 'Starting a new worker'); @@ -111,8 +104,7 @@ export class ThreadPool { export class DiskManagerTH extends ThreadPool - implements ITaskExecuter -{ + implements ITaskExecuter { execute( relativeDirectoryName: string, settings: DirectoryScanSettings = {} diff --git a/src/backend/model/threading/Worker.ts b/src/backend/model/threading/Worker.ts index 68d80760..786413be 100644 --- a/src/backend/model/threading/Worker.ts +++ b/src/backend/model/threading/Worker.ts @@ -1,9 +1,9 @@ -import { DirectoryScanSettings, DiskMangerWorker } from './DiskMangerWorker'; -import { Logger } from '../../Logger'; -import { PhotoWorker, RendererInput } from './PhotoWorker'; -import { Utils } from '../../../common/Utils'; -import { MediaDTO } from '../../../common/entities/MediaDTO'; -import { ParentDirectoryDTO } from '../../../common/entities/DirectoryDTO'; +import {DirectoryScanSettings, DiskMangerWorker} from './DiskMangerWorker'; +import {Logger} from '../../Logger'; +import {MediaRendererInput, PhotoWorker} from './PhotoWorker'; +import {Utils} from '../../../common/Utils'; +import {MediaDTO} from '../../../common/entities/MediaDTO'; +import {ParentDirectoryDTO} from '../../../common/entities/DirectoryDTO'; declare const process: NodeJS.Process; const LOG_TAG = '[Worker]'; @@ -35,7 +35,7 @@ export class Worker { result, } as WorkerMessage); } catch (err) { - process.send({ error: err, result: null }); + process.send({error: err, result: null}); } }); } @@ -56,7 +56,7 @@ export interface DiskManagerTask extends WorkerTask { } export interface ThumbnailTask extends WorkerTask { - input: RendererInput; + input: MediaRendererInput; } export const WorkerTask = {