mirror of
https://github.com/bpatrik/pigallery2.git
synced 2025-02-09 13:46:56 +02:00
optimizing module loading
This commit is contained in:
parent
1ffae0d9c5
commit
d2fdd2fe10
@ -1,10 +1,9 @@
|
|||||||
import * as cluster from "cluster";
|
import * as cluster from "cluster";
|
||||||
import {Worker} from "./model/threading/Worker";
|
|
||||||
import {Server} from "./server";
|
|
||||||
|
|
||||||
|
|
||||||
if (cluster.isMaster) {
|
if (cluster.isMaster) {
|
||||||
|
const Server = require("./server").Server;
|
||||||
new Server();
|
new Server();
|
||||||
} else {
|
} else {
|
||||||
|
const Worker = require("./model/threading/Worker").Worker;
|
||||||
Worker.process();
|
Worker.process();
|
||||||
}
|
}
|
||||||
|
@ -9,27 +9,6 @@ import {
|
|||||||
} from "../../../../common/entities/PhotoDTO";
|
} from "../../../../common/entities/PhotoDTO";
|
||||||
import {DirectoryEntity} from "./DirectoryEntity";
|
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()
|
@EmbeddableEntity()
|
||||||
export class PhotoMetadataEntity implements PhotoMetadata {
|
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()
|
@EmbeddableTable()
|
||||||
export class CameraMetadataEntity implements CameraMetadata {
|
export class CameraMetadataEntity implements CameraMetadata {
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
|
import * as fs from "fs";
|
||||||
|
import * as path from "path";
|
||||||
import {DirectoryDTO} from "../../../common/entities/DirectoryDTO";
|
import {DirectoryDTO} from "../../../common/entities/DirectoryDTO";
|
||||||
import {CameraMetadata, GPSMetadata, ImageSize, PhotoDTO, PhotoMetadata} from "../../../common/entities/PhotoDTO";
|
import {CameraMetadata, GPSMetadata, ImageSize, PhotoDTO, PhotoMetadata} from "../../../common/entities/PhotoDTO";
|
||||||
import {Logger} from "../../Logger";
|
import {Logger} from "../../Logger";
|
||||||
import * as fs from "fs";
|
|
||||||
import * as path from "path";
|
|
||||||
import {IptcParser} from "ts-node-iptc";
|
import {IptcParser} from "ts-node-iptc";
|
||||||
import {ExifParserFactory} from "ts-exif-parser";
|
import {ExifParserFactory} from "ts-exif-parser";
|
||||||
import {ProjectPath} from "../../ProjectPath";
|
import {ProjectPath} from "../../ProjectPath";
|
||||||
@ -85,7 +85,7 @@ export class DiskMangerWorker {
|
|||||||
|
|
||||||
private static loadPhotoMetadata(fullPath: string): Promise<PhotoMetadata> {
|
private static loadPhotoMetadata(fullPath: string): Promise<PhotoMetadata> {
|
||||||
return new Promise<PhotoMetadata>((resolve, reject) => {
|
return new Promise<PhotoMetadata>((resolve, reject) => {
|
||||||
fs.readFile(fullPath, (err, data) => {
|
fs.readFile(fullPath, (err, data) => {
|
||||||
if (err) {
|
if (err) {
|
||||||
return reject({file: fullPath, error: err});
|
return reject({file: fullPath, error: err});
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user