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 bug in notifications #5678

Merged
merged 3 commits into from
May 9, 2019
Merged

Conversation

stsewd
Copy link
Member

@stsewd stsewd commented May 8, 2019

If an exception is raised before setting the self.build and self.version
objects, we ended up with those having the value of {} (empty dict).

In send_notification we expect to have these objects initialized.
We should refactor this to only have one point where to catch exceptions
and send the notification from there. Related to #5672

If an exception is raised before setting the self.build and self.version
objects, we ended up with those having the value of `{}` (empty dict).

In send_notification we expect to have these objects initialized.
We should refactor this to only have one point where to catch exceptions
and send the notification from there. Related to readthedocs#5672
@stsewd stsewd requested a review from a team May 8, 2019 22:55
@stsewd
Copy link
Member Author

stsewd commented May 8, 2019

@stsewd
Copy link
Member Author

stsewd commented May 9, 2019

No changes are needed for the coporate site

@stsewd stsewd mentioned this pull request May 9, 2019
Copy link
Member

@humitos humitos left a comment

Choose a reason for hiding this comment

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

Looks good!

I think we need to adapt one of the cases to not raise an exception when there is no id for the build.

readthedocs/projects/tasks.py Show resolved Hide resolved
@stsewd
Copy link
Member Author

stsewd commented May 9, 2019

So, current flow granitize that if we ended up in the run_build function, no exception was raised while fetching the build object from the api (it's called from the else statement of the try block). Means, we always have an id.

I'm keeping the if statement just in case we mutate the object in another part of the code (not likely or I hope so p:). If the object ended up without an id or None we will see it in sentry. Current implementation has the same problem anyway.

@stsewd stsewd requested a review from a team May 9, 2019 15:47
Copy link
Member

@humitos humitos left a comment

Choose a reason for hiding this comment

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

👍

@stsewd stsewd merged commit 587e1f3 into readthedocs:master May 9, 2019
@stsewd stsewd deleted the fix-bug-in-notifications branch May 9, 2019 16:00
except vcs_support_utils.LockTimeout as e:
self.task.retry(exc=e, throw=False)
raise VersionLockedError
except SoftTimeLimitExceeded:
raise BuildTimeoutError

# Finalize build and update web servers
if build_id:
if self.build.get('id'):
Copy link
Contributor

Choose a reason for hiding this comment

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

I had a slightly different fix for this in #5549.

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