1
0
mirror of https://github.com/xuthus83/pigallery2.git synced 2025-01-14 14:43:17 +08:00

optimizing module loading

This commit is contained in:
Patrik Braun 2017-07-25 16:14:35 +02:00
parent 1ffae0d9c5
commit d2fdd2fe10
3 changed files with 27 additions and 27 deletions

View File

@ -1,10 +1,9 @@
import * as cluster from "cluster";
import {Worker} from "./model/threading/Worker";
import {Server} from "./server";
if (cluster.isMaster) {
const Server = require("./server").Server;
new Server();
} else {
const Worker = require("./model/threading/Worker").Worker;
Worker.process();
}

View File

@ -9,27 +9,6 @@ import {
} from "../../../../common/entities/PhotoDTO";
import {DirectoryEntity} from "./DirectoryEntity";
@Entity()
export class PhotoEntity implements PhotoDTO {
@PrimaryGeneratedColumn()
id: number;
@Column("string")
name: string;
@ManyToOne(type => DirectoryEntity, directory => directory.photos, {onDelete: "CASCADE"})
directory: DirectoryDTO;
@Embedded(type => PhotoMetadataEntity)
metadata: PhotoMetadataEntity;
readyThumbnails: Array<number> = [];
readyIcon: boolean = false;
}
@EmbeddableEntity()
export class PhotoMetadataEntity implements PhotoMetadata {
@ -69,6 +48,28 @@ export class PhotoMetadataEntity implements PhotoMetadata {
}
}
@Entity()
export class PhotoEntity implements PhotoDTO {
@PrimaryGeneratedColumn()
id: number;
@Column("string")
name: string;
@ManyToOne(type => DirectoryEntity, directory => directory.photos, {onDelete: "CASCADE"})
directory: DirectoryDTO;
@Embedded(type => PhotoMetadataEntity)
metadata: PhotoMetadataEntity;
readyThumbnails: Array<number> = [];
readyIcon: boolean = false;
}
/*
@EmbeddableTable()
export class CameraMetadataEntity implements CameraMetadata {

View File

@ -1,8 +1,8 @@
import * as fs from "fs";
import * as path from "path";
import {DirectoryDTO} from "../../../common/entities/DirectoryDTO";
import {CameraMetadata, GPSMetadata, ImageSize, PhotoDTO, PhotoMetadata} from "../../../common/entities/PhotoDTO";
import {Logger} from "../../Logger";
import * as fs from "fs";
import * as path from "path";
import {IptcParser} from "ts-node-iptc";
import {ExifParserFactory} from "ts-exif-parser";
import {ProjectPath} from "../../ProjectPath";
@ -85,7 +85,7 @@ export class DiskMangerWorker {
private static loadPhotoMetadata(fullPath: string): Promise<PhotoMetadata> {
return new Promise<PhotoMetadata>((resolve, reject) => {
fs.readFile(fullPath, (err, data) => {
fs.readFile(fullPath, (err, data) => {
if (err) {
return reject({file: fullPath, error: err});
}