forked from DebaucheryLibrarian/traxxx
Storing scenes before fetching movies.
This commit is contained in:
parent
7d992f4129
commit
3bfe1e8fdb
10
src/app.js
10
src/app.js
|
@ -36,7 +36,7 @@ function logActive() {
|
||||||
|
|
||||||
async function snapshotMemory() {
|
async function snapshotMemory() {
|
||||||
const profile = await inspector.heap.takeSnapshot();
|
const profile = await inspector.heap.takeSnapshot();
|
||||||
const filepath = `${dayjs().format('traxxx_snapshot_YYYY-MM-DD_HH-mm-ss')}.heapprofile`;
|
const filepath = `traxxx_snapshot_${dayjs().format('YYYY-MM-DD_HH-mm-ss')}.heapprofile`;
|
||||||
|
|
||||||
logger.info(`Start heap snapshots, memory usage: ${process.memoryUsage.rss() / 1000000} MB`);
|
logger.info(`Start heap snapshots, memory usage: ${process.memoryUsage.rss() / 1000000} MB`);
|
||||||
|
|
||||||
|
@ -48,7 +48,7 @@ async function snapshotMemory() {
|
||||||
|
|
||||||
async function stopMemorySample(snapshotTriggers) {
|
async function stopMemorySample(snapshotTriggers) {
|
||||||
const profile = await inspector.heap.stopSampling();
|
const profile = await inspector.heap.stopSampling();
|
||||||
const filepath = `${dayjs().format('traxxx_sample_YYYY-MM-DD_HH-mm-ss')}.heapprofile`;
|
const filepath = `traxxx_sample_${dayjs().format('YYYY-MM-DD_HH-mm-ss')}.heapprofile`;
|
||||||
const usage = process.memoryUsage.rss() / 1000000;
|
const usage = process.memoryUsage.rss() / 1000000;
|
||||||
|
|
||||||
await inspector.heap.disable();
|
await inspector.heap.disable();
|
||||||
|
@ -168,6 +168,8 @@ async function init() {
|
||||||
? await fetchScenes([...(sceneUrls), ...(updateBaseScenes || []), ...(actorBaseScenes || [])])
|
? await fetchScenes([...(sceneUrls), ...(updateBaseScenes || []), ...(actorBaseScenes || [])])
|
||||||
: [...(updateBaseScenes || []), ...(actorBaseScenes || [])];
|
: [...(updateBaseScenes || []), ...(actorBaseScenes || [])];
|
||||||
|
|
||||||
|
const storedScenes = argv.save ? await storeScenes(deepScenes) : [];
|
||||||
|
|
||||||
const sceneMovies = deepScenes ? deepScenes.filter((scene) => scene.movie).map((scene) => ({ ...scene.movie, entity: scene.entity })) : [];
|
const sceneMovies = deepScenes ? deepScenes.filter((scene) => scene.movie).map((scene) => ({ ...scene.movie, entity: scene.entity })) : [];
|
||||||
const deepMovies = argv.sceneMovies || argv.movie ? await fetchMovies([...(argv.movie || []), ...(sceneMovies || [])]) : sceneMovies;
|
const deepMovies = argv.sceneMovies || argv.movie ? await fetchMovies([...(argv.movie || []), ...(sceneMovies || [])]) : sceneMovies;
|
||||||
|
|
||||||
|
@ -181,9 +183,9 @@ async function init() {
|
||||||
|
|
||||||
if (argv.save) {
|
if (argv.save) {
|
||||||
const storedMovies = await storeMovies(deepMovies);
|
const storedMovies = await storeMovies(deepMovies);
|
||||||
const storedScenes = await storeScenes([...(deepScenes || []), ...(deepMovieScenes || [])]);
|
const storedMovieScenes = await storeScenes(deepMovieScenes);
|
||||||
|
|
||||||
await associateMovieScenes(storedMovies, storedScenes);
|
await associateMovieScenes(storedMovies, [...storedScenes, ...storedMovieScenes]);
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
logger.error(error);
|
logger.error(error);
|
||||||
|
|
Loading…
Reference in New Issue