diff --git a/cas_server/default_settings.py b/cas_server/default_settings.py index 1e052af..b1d4333 100644 --- a/cas_server/default_settings.py +++ b/cas_server/default_settings.py @@ -56,6 +56,10 @@ setting_default('CAS_PROXY_GRANTING_TICKET_PREFIX', 'PGT') # Services MUST be able to handle PGTIOUs of up to 64 characters in length. setting_default('CAS_PROXY_GRANTING_TICKET_IOU_PREFIX', 'PGTIOU') +# Maximum number of parallel single log out requests send +# if more requests need to be send, there are queued +setting_default('CAS_SLO_MAX_PARALLEL_REQUESTS', 10) + setting_default('CAS_SQL_HOST', 'localhost') setting_default('CAS_SQL_USERNAME', '') setting_default('CAS_SQL_PASSWORD', '') diff --git a/cas_server/models.py b/cas_server/models.py index c735537..8424d3a 100644 --- a/cas_server/models.py +++ b/cas_server/models.py @@ -67,7 +67,9 @@ class User(models.Model): def logout(self, request=None): """Sending SLO request to all services the user logged in""" async_list = [] - session = FuturesSession(executor=ThreadPoolExecutor(max_workers=10)) + session = FuturesSession( + executor=ThreadPoolExecutor(max_workers=settings.CAS_SLO_MAX_PARALLEL_REQUESTS) + ) # first invalidate all Tickets ticket_classes = [ProxyGrantingTicket, ServiceTicket, ProxyTicket] for ticket_class in ticket_classes: @@ -357,7 +359,9 @@ class Ticket(models.Model): # sending SLO to timed-out validated tickets if cls.TIMEOUT and cls.TIMEOUT > 0: async_list = [] - session = FuturesSession(executor=ThreadPoolExecutor(max_workers=10)) + session = FuturesSession( + executor=ThreadPoolExecutor(max_workers=settings.CAS_SLO_MAX_PARALLEL_REQUESTS) + ) queryset = cls.objects.filter( creation__lt=(timezone.now() - timedelta(seconds=cls.TIMEOUT)) )