Wednesday, July 27, 2016

Any way to force Django to commit a write so another process can read the correct data from DB?

My website uses a combination of Django + Java apps to function. For this particular problem, a record is deleted from the DB via a TastyPie resource DELETE operation. A Django signal post_delete handleris invoked, which submits a DELETE request to Jetty running in the Java app. The Java app then performs a query using Hibernate.

What appears to be happening is that Django thinks the record was deleted:

DynamicVolume.objects.filter(user=instance.user).count()

Returns ZERO.

However, the Java app thinks the record still exists unless I make it sleep for several seconds before asking Hibernate to query the DB.

I've tried forcing Hibernate to clear its cache with no success. Is there a way to force Django to commit the deletion (flush the cache)?

Thanks

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/e76d5cfa-f4bc-41db-a322-0d44aa0719dd%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment