장고의 ORM을 사용하여 Db에서 새로 추가 된 항목을 가져 와서 메시징 큐에 전달합니다. 내가 추가 한 경우 루프, 심지어 같은 검색어 세트를 얻고마다 루프 반복의 문제가/삭제/편집 항목이 스크립트가 실행 중일 때 동안 나는, 무한에계속 반복되는 스크립트에서 Django 쿼리 세트에 반영되지 않은 DB 데이터의 변경
코드를이 일을하고하는 것은 다음과 같이 진행됩니다
while True :
sleep(10 seconds)
# Below is the problem line, I get the same query-set every time in new_objects
# even when I have added/deleted/edited entries while this daemon is running.
new_objects = Model.objects.filter(some condition)
# Process new_objects and send them to MQ
.
. and so on
각 반복의 최신 데이터를 반영하려면 어떻게해야합니까?
복제 http://stackoverflow.com/questions/1886909/how-to-disable-django-query-cache – Dominik