リモートファイルの削除が重い問題を修正

This commit is contained in:
syuilo 2019-07-01 21:12:14 +09:00
parent ed0070c470
commit 03e999875a
No known key found for this signature in database
GPG key ID: BDC4C49D06AB9D69
7 changed files with 116 additions and 27 deletions

View file

@ -1,22 +1,10 @@
import * as Bull from 'bull';
import * as Minio from 'minio';
import { fetchMeta } from '../../../misc/fetch-meta';
import { deleteObjectStorageFile } from '../../../services/drive/delete-file';
export default async (job: Bull.Job) => {
const meta = await fetchMeta();
const minio = new Minio.Client({
endPoint: meta.objectStorageEndpoint!,
region: meta.objectStorageRegion ? meta.objectStorageRegion : undefined,
port: meta.objectStoragePort ? meta.objectStoragePort : undefined,
useSSL: meta.objectStorageUseSSL,
accessKey: meta.objectStorageAccessKey!,
secretKey: meta.objectStorageSecretKey!,
});
const key: string = job.data.key;
await minio.removeObject(meta.objectStorageBucket!, key);
await deleteObjectStorageFile(key);
return 'Success';
};