Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(robot-server): consolidate DB transactions, fix a max analyses length bug #14904

Conversation

sanni-t
Copy link
Member

@sanni-t sanni-t commented Apr 15, 2024

Closes AUTH-347

Overview

#14885 added the feature to limit number of analyses we store in DB. In this comment, @SyntaxColoring pointed out that we should consolidate the DB transactions for better performance, so that's what this PR does.

Also fixes a bug where if the existing number of analyses in the DB was 3 and we were to add another analysis, then the formula for getting the analysis IDs to delete would result in analysis_ids[:-1] and it would delete all analyses except last one.

Test Plan

Risk assessment

Low. Refactor + small bug fix

@sanni-t sanni-t requested a review from a team as a code owner April 15, 2024 18:17
@sanni-t sanni-t requested review from a team, jbleon95, Elyorcv and SyntaxColoring and removed request for a team and Elyorcv April 15, 2024 18:21
Copy link
Contributor

@SyntaxColoring SyntaxColoring left a comment

Choose a reason for hiding this comment

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

TY!

Copy link
Contributor

@jbleon95 jbleon95 left a comment

Choose a reason for hiding this comment

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

LGTM!

@sanni-t sanni-t merged commit b8c08aa into edge Apr 15, 2024
13 checks passed
@sanni-t sanni-t deleted the AUTH-347-refactor-consolidate-db-transactions-when-adding-deleting-analyses branch April 15, 2024 18:45
Carlos-fernandez pushed a commit that referenced this pull request May 20, 2024
…es length bug (#14904)

Closes AUTH-347

# Overview

#14885 added the feature to limit number of analyses we store in DB. In
[this](#14885 (comment))
comment, @SyntaxColoring pointed out that we should consolidate the DB
transactions for better performance, so that's what this PR does.

Also fixes a bug where if the existing number of analyses in the DB was
3 and we were to add another analysis, then the formula for getting the
analysis IDs to delete would result in `analysis_ids[:-1]` and it would
delete all analyses except last one.

# Test Plan

- Tested the cases mentioned in #14885 
- Tested the bug case

# Risk assessment

Low. Refactor + small bug fix
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants