mirror of
https://github.com/immich-app/immich.git
synced 2026-05-18 03:10:24 +03:00
refactor: use storage repository stat instead of real stat
This commit is contained in:
@@ -1,7 +1,6 @@
|
|||||||
import { Injectable } from '@nestjs/common';
|
import { Injectable } from '@nestjs/common';
|
||||||
import { createHash } from 'node:crypto';
|
import { createHash } from 'node:crypto';
|
||||||
import { createReadStream } from 'node:fs';
|
import { createReadStream } from 'node:fs';
|
||||||
import { stat } from 'node:fs/promises';
|
|
||||||
import { basename } from 'node:path';
|
import { basename } from 'node:path';
|
||||||
import { Readable, Writable } from 'node:stream';
|
import { Readable, Writable } from 'node:stream';
|
||||||
import { pipeline } from 'node:stream/promises';
|
import { pipeline } from 'node:stream/promises';
|
||||||
@@ -322,7 +321,8 @@ export class IntegrityService extends BaseService {
|
|||||||
|
|
||||||
const results = await Promise.all(
|
const results = await Promise.all(
|
||||||
items.map(({ reportId, path }) =>
|
items.map(({ reportId, path }) =>
|
||||||
stat(path)
|
this.storageRepository
|
||||||
|
.stat(path)
|
||||||
.then(() => void 0)
|
.then(() => void 0)
|
||||||
.catch(() => reportId),
|
.catch(() => reportId),
|
||||||
),
|
),
|
||||||
@@ -388,7 +388,8 @@ export class IntegrityService extends BaseService {
|
|||||||
|
|
||||||
const results = await Promise.all(
|
const results = await Promise.all(
|
||||||
items.map((item) =>
|
items.map((item) =>
|
||||||
stat(item.path)
|
this.storageRepository
|
||||||
|
.stat(item.path)
|
||||||
.then(() => ({ ...item, exists: true }))
|
.then(() => ({ ...item, exists: true }))
|
||||||
.catch(() => ({ ...item, exists: false })),
|
.catch(() => ({ ...item, exists: false })),
|
||||||
),
|
),
|
||||||
@@ -424,7 +425,8 @@ export class IntegrityService extends BaseService {
|
|||||||
|
|
||||||
const results = await Promise.all(
|
const results = await Promise.all(
|
||||||
paths.map(({ reportId, path }) =>
|
paths.map(({ reportId, path }) =>
|
||||||
stat(path)
|
this.storageRepository
|
||||||
|
.stat(path)
|
||||||
.then(() => reportId)
|
.then(() => reportId)
|
||||||
.catch(() => void 0),
|
.catch(() => void 0),
|
||||||
),
|
),
|
||||||
|
|||||||
Reference in New Issue
Block a user