A Django management command will by default open one transaction for the whole run. You probably want to explicitly manage transactions and commit before sleeping.