diff --git a/docs/settings.rst b/docs/settings.rst index 49460bc0e..01baaaf4b 100644 --- a/docs/settings.rst +++ b/docs/settings.rst @@ -345,10 +345,13 @@ The size of delete batches used by ``cleartokens`` management command. CLEAR_EXPIRED_TOKENS_BATCH_INTERVAL ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -Default: ``0.1`` +Default: ``0`` Time of sleep in seconds used by ``cleartokens`` management command between batch deletions. +Set this to a non-zero value (e.g. `0.1`) to add a pause between batch sizes to reduce system +load when clearing large batches of expired tokens. + Settings imported from Django project -------------------------- diff --git a/oauth2_provider/settings.py b/oauth2_provider/settings.py index 22e067716..3b7dea3f8 100644 --- a/oauth2_provider/settings.py +++ b/oauth2_provider/settings.py @@ -102,7 +102,7 @@ # Should only be required in testing. "ALWAYS_RELOAD_OAUTHLIB_CORE": False, "CLEAR_EXPIRED_TOKENS_BATCH_SIZE": 10000, - "CLEAR_EXPIRED_TOKENS_BATCH_INTERVAL": 0.1, + "CLEAR_EXPIRED_TOKENS_BATCH_INTERVAL": 0, } # List of settings that cannot be empty