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 May 8, 2019
@stsewd
Copy link
Member Author

@stsewd stsewd commented May 8, 2019

@stsewd
Copy link
Member Author

@stsewd 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

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 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 May 9, 2019
humitos
humitos approved these changes May 9, 2019
Copy link
Member

@humitos humitos left a comment

👍

@stsewd stsewd merged commit 587e1f3 into readthedocs:master May 9, 2019
1 check passed
@stsewd stsewd deleted the fix-bug-in-notifications branch May 9, 2019
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

@davidfischer davidfischer May 9, 2019

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
Linked issues

Successfully merging this pull request may close these issues.

None yet

3 participants