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

fix(worker): do not update source if it is unknown #2928

Merged
merged 4 commits into from
Nov 28, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions docker/worker/worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -333,6 +333,10 @@ def _source_update(self, message):
deleted = message.attributes['deleted'] == 'true'

source_repo = osv.get_source_repository(source)
if source_repo is None:
logging.error('Failed to get source repository %s', source)
Copy link
Contributor

Choose a reason for hiding this comment

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

To make this logged error more debuggable and actionable, it may be better to raise an exception to the caller, which will then be able to add the offending record's ID to the exception.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes - I also thought of adding ID to the error message so raising an exception is a good idea! I have made #2933 to address this.

return

if source_repo.type == osv.SourceRepositoryType.GIT:
repo = osv.ensure_updated_checkout(
source_repo.repo_url,
Expand Down
Loading