Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: kirkrodrigues <[email protected]>
  • Loading branch information
haiqi96 and kirkrodrigues authored Jan 19, 2025
1 parent 78625a3 commit e8560d4
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -939,6 +939,7 @@ def start_log_viewer_webui(
settings_json_updates["StreamFilesS3PathPrefix"] = (
f"{s3_config.bucket}/{s3_config.key_prefix}"
)

access_key_id, secret_access_key = s3_config.get_credentials()
if access_key_id is not None and secret_access_key is not None:
container_cmd_extra_opts.extend(
Expand Down
1 change: 1 addition & 0 deletions components/log-viewer-webui/server/src/S3Manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ class S3Manager {
*
* @param {string} s3uriString The S3 object URI string.
* @return {Promise<string>} The pre-signed URL string.
* @throws {Error} If a pre-signed URL couldn't be generated.
*/
async getPreSignedUrl (s3uriString) {
const s3uri = new URL(s3uriString);
Expand Down
8 changes: 3 additions & 5 deletions components/log-viewer-webui/server/src/routes/query.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const S3_MANAGER = (


/**
* Submits a stream extraction job and returns the metadata of the extracted stream
* Submits a stream extraction job and returns the metadata of the extracted stream.
*
* @param {object} props
* @param {import("fastify").FastifyInstance | {dbManager: DbManager}} props.fastify
Expand All @@ -37,18 +37,16 @@ const extractStreamAndGetMetadata = async ({
streamId: streamId,
targetUncompressedSize: settings.StreamTargetUncompressedSize,
});

if (null === extractResult) {
resp.code(StatusCodes.BAD_REQUEST);
throw new Error("Unable to extract stream with " +
`streamId=${streamId} at logEventIdx=${logEventIdx}`);
throw new Error(`Unable to extract stream with streamId=${streamId} at ` +
`logEventIdx=${logEventIdx}`);
}

const streamMetadata = fastify.dbManager.getExtractedStreamFileMetadata(
streamId,
logEventIdx
);

if (null === streamMetadata) {
resp.code(StatusCodes.BAD_REQUEST);
throw new Error("Unable to find the metadata of extracted stream with " +
Expand Down

0 comments on commit e8560d4

Please sign in to comment.