mirror of
https://github.com/xuthus83/pigallery2.git
synced 2024-11-03 21:04:03 +08:00
Fix types
This commit is contained in:
parent
b7529b13e1
commit
1c9e2a08aa
@ -1,18 +1,11 @@
|
|||||||
import * as cluster from 'cluster';
|
import * as cluster from 'cluster';
|
||||||
import { Worker } from 'cluster';
|
import {Worker} from 'cluster';
|
||||||
import { Logger } from '../../Logger';
|
import {Logger} from '../../Logger';
|
||||||
import {
|
import {DiskManagerTask, WorkerMessage, WorkerTask, WorkerTaskTypes,} from './Worker';
|
||||||
DiskManagerTask,
|
import {ParentDirectoryDTO} from '../../../common/entities/DirectoryDTO';
|
||||||
ThumbnailTask,
|
import {TaskQue, TaskQueEntry} from './TaskQue';
|
||||||
WorkerMessage,
|
import {ITaskExecuter} from './TaskExecuter';
|
||||||
WorkerTask,
|
import {DirectoryScanSettings} from './DiskMangerWorker';
|
||||||
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';
|
|
||||||
|
|
||||||
interface WorkerWrapper<O> {
|
interface WorkerWrapper<O> {
|
||||||
worker: Worker;
|
worker: Worker;
|
||||||
@ -81,12 +74,12 @@ export class ThreadPool<O> {
|
|||||||
Logger.warn(
|
Logger.warn(
|
||||||
LOG_TAG,
|
LOG_TAG,
|
||||||
'Worker ' +
|
'Worker ' +
|
||||||
worker.worker.process.pid +
|
worker.worker.process.pid +
|
||||||
' died with code: ' +
|
' died with code: ' +
|
||||||
code +
|
code +
|
||||||
', and signal: ' +
|
', and signal: ' +
|
||||||
signal +
|
signal +
|
||||||
', worker count:',
|
', worker count:',
|
||||||
ThreadPool.WorkerCount
|
ThreadPool.WorkerCount
|
||||||
);
|
);
|
||||||
Logger.debug(LOG_TAG, 'Starting a new worker');
|
Logger.debug(LOG_TAG, 'Starting a new worker');
|
||||||
@ -111,8 +104,7 @@ export class ThreadPool<O> {
|
|||||||
|
|
||||||
export class DiskManagerTH
|
export class DiskManagerTH
|
||||||
extends ThreadPool<ParentDirectoryDTO>
|
extends ThreadPool<ParentDirectoryDTO>
|
||||||
implements ITaskExecuter<string, ParentDirectoryDTO>
|
implements ITaskExecuter<string, ParentDirectoryDTO> {
|
||||||
{
|
|
||||||
execute(
|
execute(
|
||||||
relativeDirectoryName: string,
|
relativeDirectoryName: string,
|
||||||
settings: DirectoryScanSettings = {}
|
settings: DirectoryScanSettings = {}
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
import { DirectoryScanSettings, DiskMangerWorker } from './DiskMangerWorker';
|
import {DirectoryScanSettings, DiskMangerWorker} from './DiskMangerWorker';
|
||||||
import { Logger } from '../../Logger';
|
import {Logger} from '../../Logger';
|
||||||
import { PhotoWorker, RendererInput } from './PhotoWorker';
|
import {MediaRendererInput, PhotoWorker} from './PhotoWorker';
|
||||||
import { Utils } from '../../../common/Utils';
|
import {Utils} from '../../../common/Utils';
|
||||||
import { MediaDTO } from '../../../common/entities/MediaDTO';
|
import {MediaDTO} from '../../../common/entities/MediaDTO';
|
||||||
import { ParentDirectoryDTO } from '../../../common/entities/DirectoryDTO';
|
import {ParentDirectoryDTO} from '../../../common/entities/DirectoryDTO';
|
||||||
|
|
||||||
declare const process: NodeJS.Process;
|
declare const process: NodeJS.Process;
|
||||||
const LOG_TAG = '[Worker]';
|
const LOG_TAG = '[Worker]';
|
||||||
@ -35,7 +35,7 @@ export class Worker {
|
|||||||
result,
|
result,
|
||||||
} as WorkerMessage<O>);
|
} as WorkerMessage<O>);
|
||||||
} catch (err) {
|
} 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 {
|
export interface ThumbnailTask extends WorkerTask {
|
||||||
input: RendererInput;
|
input: MediaRendererInput;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const WorkerTask = {
|
export const WorkerTask = {
|
||||||
|
Loading…
Reference in New Issue
Block a user