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 invalid state, which happen if signals raise exception #61

Closed
wants to merge 2 commits into from

Conversation

Andertaker
Copy link

No description provided.

@vdboor
Copy link
Collaborator

vdboor commented Apr 13, 2015

I wonder, won't it work if the whole .save() method was wrapped inside a transation?

if self.submit_date is None: # for comment save
self.submit_date = timezone.now()
Comment.objects.bulk_create([self])
c = Comment.objects.latest("id")
Copy link
Owner

Choose a reason for hiding this comment

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

this is by no means safe, it is a race condition

@honzakral
Copy link
Owner

This is not a valid fix, it introduces several other issues, not to mention raw SQL. Proper handling of this is to encourage use of transaction middleware.

@vdboor vdboor closed this Apr 15, 2015
@vdboor
Copy link
Collaborator

vdboor commented Apr 15, 2015

Indeed. This needs to be solved in a better way.

@Sonicmr
Copy link

Sonicmr commented Apr 30, 2015

I am having the same problem here, anyone fixed it yet ?

@Sonicmr
Copy link

Sonicmr commented May 2, 2015

This fix is breaking ajax when replying

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.

None yet

5 participants