Skip to content

Conversation

AmirAllayarovSofteq
Copy link
Contributor

No description provided.

@AmirAllayarovSofteq AmirAllayarovSofteq added the feature New feature or request label Nov 2, 2022
@AmirAllayarovSofteq AmirAllayarovSofteq self-assigned this Nov 2, 2022
if (executionTimeInNanoseconds !== 0) {
commandExecution.executionTime = Math.round(executionTimeInNanoseconds / 1000);
}

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure that using hrtime() is a correct way here.
At first it is legacy function - https://nodejs.org/api/process.html#processhrtimetime. If you want to use use node:process then you should look into hrtime.bugint()
Anothe thing here that you get nanoseconds and then you've added additional check and division to get milliseconds and after all you are rounding value. Why? Will it be more easy to use Data.now() and calculate difference between it? Simple it could be achieved in 2 rows const start = Date.now() and commandExecution.executionTime = Date.now() - statrt. That is it.

rsergeenko
rsergeenko previously approved these changes Nov 4, 2022
Base automatically changed from feature/RI-2831_browser-redisearch to main November 4, 2022 14:47
ArtemHoruzhenko
ArtemHoruzhenko previously approved these changes Nov 7, 2022
.toEqual(mockCommandExecutionToRun);
const result = await service.createCommandExecution(mockClientOptions, mockCreateCommandExecutionDto);
// can't predict execution time
expect(result).toMatchObject(mockCommandExecutionToRun);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

toMatchObject nice! didn't know this useful feature :)

@AlenaSY AlenaSY requested a review from vlad-dargel November 7, 2022 16:34
@AlenaSY AlenaSY merged commit 3917d2e into main Nov 8, 2022
@AlenaSY AlenaSY deleted the feature/RI-3751_command_execution_time branch November 8, 2022 09:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants