Skip to content

Commit

Permalink
chore(S3DataStore): less debug logs
Browse files Browse the repository at this point in the history
  • Loading branch information
karlprieb committed Nov 25, 2024
1 parent 4527891 commit 71a6e11
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 58 deletions.
42 changes: 1 addition & 41 deletions src/store/s3-data-store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,12 +73,6 @@ export class S3DataStore implements ContiguousDataStore {
const log = this.log.child({ method: 'has' });
const key = this.s3Key(hash);

log.debug('Checking if object exists in S3', {
hash,
bucket: this.s3Bucket,
key,
});

try {
await this.s3Client.HeadObject({
Bucket: this.s3Bucket,
Expand Down Expand Up @@ -128,13 +122,6 @@ export class S3DataStore implements ContiguousDataStore {
const log = this.log.child({ method: 'get' });
const key = this.s3Key(hash);

log.debug('Getting object from S3', {
hash,
bucket: this.s3Bucket,
key,
...region,
});

try {
const params: {
Bucket: string;
Expand Down Expand Up @@ -218,7 +205,7 @@ export class S3DataStore implements ContiguousDataStore {
const log = this.log.child({ method: 'finalize' });
const key = this.s3Key(hash);

log.debug('Finalizing data stream to S3 using multipart upload', {
log.debug('Finalizing data stream to S3', {
hash,
bucket: this.s3Bucket,
key,
Expand All @@ -233,11 +220,6 @@ export class S3DataStore implements ContiguousDataStore {
const fileStats = await fs.promises.stat(stream.path);
const fileSize = fileStats.size;

log.debug('File stats for upload', {
size: fileSize,
path: stream.path,
});

if (fileSize === 0) {
throw new Error('Cannot upload empty file');
}
Expand Down Expand Up @@ -276,13 +258,6 @@ export class S3DataStore implements ContiguousDataStore {
const partSize = MIN_PART_SIZE;
const numParts = Math.ceil(fileSize / partSize);

log.debug('Starting multipart upload', {
uploadId,
numParts,
partSize,
totalSize: fileSize,
});

const fileHandle = await fs.promises.open(stream.path, 'r');
try {
for (let partNumber = 1; partNumber <= numParts; partNumber++) {
Expand All @@ -304,11 +279,6 @@ export class S3DataStore implements ContiguousDataStore {
);
}

log.debug(`Uploading part ${partNumber}/${numParts}`, {
partNumber,
size: currentPartSize,
});

const response = await this.s3Client.UploadPart({
Bucket: this.s3Bucket,
Key: `${key}?partNumber=${partNumber}&uploadId=${uploadId}`,
Expand All @@ -320,15 +290,8 @@ export class S3DataStore implements ContiguousDataStore {
}

parts.push({ PartNumber: partNumber, ETag: response.ETag });

log.debug(`Successfully uploaded part ${partNumber}/${numParts}`);
}

log.debug('Completing multipart upload', {
uploadId,
numParts: parts.length,
});

await this.s3Client.CompleteMultipartUpload({
Bucket: this.s3Bucket,
Key: key,
Expand All @@ -348,9 +311,6 @@ export class S3DataStore implements ContiguousDataStore {
}

await fs.promises.unlink(stream.path);
log.debug('Cleaned up temporary file', {
tempPath: stream.path,
});
} catch (error: any) {
log.error('Failed to finalize data stream to S3', {
hash,
Expand Down
16 changes: 0 additions & 16 deletions src/types/aws-lite-s3.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,22 +16,6 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

// declare module '@aws-lite/s3' {
// import {
// S3ClientConfig,
// GetObjectCommandInput,
// PutObjectCommandInput,
// GetObjectCommandOutput,
// PutObjectCommandOutput,
// } from '@aws-sdk/client-s3';

// interface S3Client {
// getObject(params: GetObjectCommandInput): Promise<GetObjectCommandOutput>;
// }

// export default function s3(options: S3ClientConfig): S3Client;
// }

declare module '@aws-lite/s3' {
import { AwsLiteS3 } from '@aws-lite/s3-types';

Expand Down
2 changes: 1 addition & 1 deletion src/workers/transaction-fetcher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
import { default as fastq } from 'fastq';
import type { queueAsPromised } from 'fastq';
import * as EventEmitter from 'node:events';
import wait from 'wait';
import { default as wait } from 'wait';
import * as winston from 'winston';

import * as events from '../events.js';
Expand Down

0 comments on commit 71a6e11

Please sign in to comment.