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

[Bundle Analysis] Cache config service get_or_create #464

Merged
merged 2 commits into from
Jan 6, 2025

Conversation

JerrySentry
Copy link
Contributor

Add get_or_create, will have to use this instead of update_or_create in the BA processor. Currently we will always overwrite what the caching bool to true when doing a new commit into default branch. When switching to this the intention is that if the bundle cache data already exists we will not overwrite it to true.

Legal Boilerplate

Look, I get it. The entity doing business as "Sentry" was incorporated in the State of Delaware in 2015 as Functional Software, Inc. In 2022 this entity acquired Codecov and as result Sentry is going to need some rights from me in order to utilize my contributions in this PR. So here's the deal: I retain all rights, title and interest in and to my contributions, and by keeping this boilerplate intact I confirm that Sentry can use, modify, copy, and redistribute my contributions, under Sentry's choice of terms.

@JerrySentry JerrySentry marked this pull request as ready for review January 6, 2025 21:50
@@ -7,3 +7,9 @@ def update_cache_option(repo_id, name, is_caching=True) -> None:
CacheConfig.objects.update_or_create(
repo_id=repo_id, bundle_name=name, defaults={"is_caching": is_caching}
)

@staticmethod
def create_cache_option(repo_id, name, is_caching=True) -> None:
Copy link
Contributor

Choose a reason for hiding this comment

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

any thoughts on naming the method same with get_or_create or create_if_not_exists?
also, wondering if that means we will remove the update_or_create one now?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I like create_if_not_exists, get_or_create implies I need to return something in this method.
update_or_create will be used by the API in the next couple of PRs, but I'm gonna rename it to update_cache_option because it won't be creating.

Copy link

codecov bot commented Jan 6, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 89.97%. Comparing base (efe4835) to head (2eeb955).
Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #464      +/-   ##
==========================================
- Coverage   90.54%   89.97%   -0.57%     
==========================================
  Files         403      324      -79     
  Lines       12531     9199    -3332     
  Branches     2105     1633     -472     
==========================================
- Hits        11346     8277    -3069     
+ Misses       1076      859     -217     
+ Partials      109       63      -46     
Flag Coverage Δ
shared-docker-uploader ?

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@JerrySentry JerrySentry added this pull request to the merge queue Jan 6, 2025
Merged via the queue into main with commit 67879c1 Jan 6, 2025
6 checks passed
@JerrySentry JerrySentry deleted the jan_06_cache_config branch January 6, 2025 23:34
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.

2 participants