Closed tejinderss closed 11 years ago
Can you provide a traceback with some more information? It's hard to understand what's happening here…
I think the issue lies at the heart of transaction commit. While in the view the default behaviour is commit on success, and we are creating an instance in subscribe manager which does not get commited to db until that view (which calls the subscribe manager) has been returned successfully which will never happen because google api tries to make a get request to our server with subscription pk which has not been commited to db yet hence it raised 404 errors to PUSH GET request. I hope I am making things clear.
This is fixed with the pull request I just merged if I understood things correctly.
This does fix the issue but we are putting a lot of extra work on the user. The user must commit the view db transactions manually. Alternatively we could resort to storing verify_token in cache, which will be readily available in the view and we can set its timeout value to like 60 seconds. So it will be like we cache the pk of the Subscription instance just created and check in GET request to match that pk in cache, if found we get_or_create that subscription instance and updating its state to verified. What do you think? If this sounds good, I can work on it?
What are your transaction settings? Do you use TransactionMiddleware by any chance? A quick workaround would be to decorate your view with @transaction.autocommit
.
The issue is that with Django we can't really assume the cache to be always configured.
True. You are right my app does indeed use TransactionMiddleware. I should have checked that earlier. Sorry for that mate. Let me check with @autocommit.
HTTPError: HTTP Error 409: Conflict
I get this error when I call subscribe from within django's view. If i call it from django shell, it works perfectly fine.