api call retry
This commit is contained in:
parent
c004f6c34f
commit
bb072cc91c
11 changed files with 126 additions and 23 deletions
|
|
@ -1,5 +1,7 @@
|
|||
import { Storage } from "@google-cloud/storage";
|
||||
import { Files } from "@google/genai";
|
||||
import zlib from "zlib";
|
||||
import { CLOUD_STORAGE_LOG_FOLDER_NAME } from "../../serverConfig";
|
||||
|
||||
const csClient = new Storage({projectId: process.env.PROJECT_ID});
|
||||
const BUCKET_NAME = process.env.CLOUD_STORAGE_BUCKET_NAME || '';
|
||||
|
|
@ -42,4 +44,19 @@ export const storageController = {
|
|||
return false;
|
||||
}
|
||||
},
|
||||
getFileList: async(): Promise<string[] | null> => {
|
||||
try {
|
||||
const files = await bucket.getFiles({
|
||||
prefix: 'request_log/',
|
||||
});
|
||||
const list = [];
|
||||
for(const f of files[0]) {
|
||||
// console.log(f.name)
|
||||
list.push(f.name);
|
||||
}
|
||||
return list;
|
||||
} catch(error) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue