From aefd5073a75c661ff55269483f350a7854f47822 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Norman=20J=C3=A4ckel?= Date: Tue, 10 Jan 2017 21:43:53 +0100 Subject: [PATCH 1/2] Skipped autoupdate for user during login. See #2804. --- openslides/users/models.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/openslides/users/models.py b/openslides/users/models.py index 415ed2c29..7cc49008c 100644 --- a/openslides/users/models.py +++ b/openslides/users/models.py @@ -14,6 +14,7 @@ from django.db.models import Prefetch, Q from openslides.utils.search import user_name_helper +from ..utils.collection import CollectionElement from ..utils.models import RESTModelMixin from .access_permissions import GroupAccessPermissions, UserAccessPermissions @@ -196,6 +197,16 @@ class User(RESTModelMixin, PermissionsMixin, AbstractBaseUser): # Return result return name + def save(self, *args, **kwargs): + """ + Overridden method to skip autoupdate if only last_login field was + updated as it is done during login. + """ + if kwargs.get('update_fields') == ['last_login']: + kwargs['skip_autoupdate'] = True + CollectionElement.from_instance(self) + return super().save(*args, **kwargs) + def get_search_index_string(self): """ Returns a string that can be indexed for the search. From acab868c79743601bb5fe7d213c4e59641e8daf9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Norman=20J=C3=A4ckel?= Date: Sat, 14 Jan 2017 17:15:30 +0100 Subject: [PATCH 2/2] Quickfix for #2865. The problem is not completely solved. --- openslides/utils/search.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/openslides/utils/search.py b/openslides/utils/search.py index 0da9b4f63..4193ac87f 100644 --- a/openslides/utils/search.py +++ b/openslides/utils/search.py @@ -73,7 +73,12 @@ class Index: pass path = self.get_index_path() if path != 'ram' and exists_in(path): - return open_dir(path) + # Quick fix to bypass errors when many clients login. + # TODO: Solve this hack. + try: + return open_dir(path) + except FileNotFoundError: + pass return self.create_index()