From 284eb0b8f650e217753cb4b82d076c2eea6ba6e3 Mon Sep 17 00:00:00 2001 From: Alan Crosswell Date: Thu, 13 Jan 2022 15:19:41 -0500 Subject: [PATCH 1/2] Set default value for CLEAR_EXPIRED_TOKENS_BATCH_INTERVAL to sleep(0). --- oauth2_provider/settings.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 From 0fa978764e0d3dbff4d0810eb30c817540dd74aa Mon Sep 17 00:00:00 2001 From: Alan Crosswell Date: Thu, 13 Jan 2022 15:28:27 -0500 Subject: [PATCH 2/2] Document default value of 0 for CLEAR_EXPIRED_TOKENS_BATCH_INTERVAL. --- docs/settings.rst | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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 --------------------------