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

Add composite unique on name and version #88

Merged
merged 4 commits into from
Jun 27, 2023
Merged

Conversation

Robin5605
Copy link
Contributor

Removes a lot of the previous code that did checking on on the batch queue endpoint for duplicates. The old code was awkward and unwieldy, this is however, much better. It allows us to simply iterate over all the ingested packages, and add them to the database without any extra queries required for checking if they already exist or not.

Copy link
Contributor

@jonathan-d-zhang jonathan-d-zhang left a comment

Choose a reason for hiding this comment

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

nits, but alright

async with session.begin_nested():
session.add(row)
except IntegrityError:
pass
Copy link
Contributor

Choose a reason for hiding this comment

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

not logging this? or returning errors?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Didn't figure it was necessary. Attempting to scan duplicate packages is going to be very common - after all the mechanism that's going to be reading from the RSS feed and loading it into the database doesn't do any of the checking. 90-95% of packages batch queued will already be queued for scanning in the database

src/mainframe/endpoints/package.py Outdated Show resolved Hide resolved
@Robin5605 Robin5605 merged commit efb0f2b into main Jun 27, 2023
2 checks passed
@Robin5605 Robin5605 deleted the unique-constraint branch June 27, 2023 22:33
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.

3 participants