mirror of
https://github.com/tdurieux/anonymous_github.git
synced 2026-02-13 02:42:45 +00:00
fix: improve S3 reliability
This commit is contained in:
@@ -106,7 +106,9 @@ export default class GitHubDownload extends GitHubBase implements SourceBase {
|
||||
|
||||
try {
|
||||
const downloadStream = got.stream(response.url);
|
||||
downloadStream.addListener("downloadProgress", (p) => (progress = p));
|
||||
downloadStream.addListener("downloadProgress", async (p) => {
|
||||
progress = p;
|
||||
});
|
||||
await storage.extractZip(originalPath, downloadStream, undefined, this);
|
||||
} catch (error) {
|
||||
await this.repository.updateStatus(
|
||||
|
||||
@@ -71,10 +71,10 @@ export default class S3Storage implements StorageBase {
|
||||
/** @override */
|
||||
async rm(dir: string): Promise<void> {
|
||||
if (!config.S3_BUCKET) throw new Error("S3_BUCKET not set");
|
||||
const data = await this.client().listObjectsV2({
|
||||
const data = await this.client(200000).listObjectsV2({
|
||||
Bucket: config.S3_BUCKET,
|
||||
Prefix: dir,
|
||||
MaxKeys: 1000,
|
||||
MaxKeys: 100,
|
||||
});
|
||||
|
||||
const params = {
|
||||
@@ -92,7 +92,7 @@ export default class S3Storage implements StorageBase {
|
||||
// nothing to remove
|
||||
return;
|
||||
}
|
||||
await this.client().deleteObjects(params);
|
||||
await this.client(200000).deleteObjects(params);
|
||||
|
||||
if (data.IsTruncated) {
|
||||
await this.rm(dir);
|
||||
@@ -249,11 +249,9 @@ export default class S3Storage implements StorageBase {
|
||||
};
|
||||
}
|
||||
},
|
||||
maxParallel: 10,
|
||||
});
|
||||
pipeline(data, toS3, (err) => {
|
||||
if (err) reject(err);
|
||||
else resolve();
|
||||
})
|
||||
pipeline(data, toS3, () => {})
|
||||
.on("finish", resolve)
|
||||
.on("error", reject);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user