From 91b053418242e9f514d061491b90bad1baae2349 Mon Sep 17 00:00:00 2001 From: grossmj Date: Tue, 1 Jun 2021 12:56:51 +0930 Subject: [PATCH 1/2] Upgrade dependencies --- requirements.txt | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/requirements.txt b/requirements.txt index 20be3627..f58a051c 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,16 +1,16 @@ uvicorn==0.13.4 -fastapi==0.64.0 -websockets==9.0.1 +fastapi==0.65.1 +websockets==9.1 python-multipart==0.0.5 aiohttp==3.7.4.post0 -aiofiles==0.6.0 -Jinja2==2.11.3 +aiofiles==0.7.0 +Jinja2==3.0.1 sentry-sdk==1.1.0 psutil==5.8.0 async-timeout==3.0.1 distro==1.5.0 py-cpuinfo==8.0.0 -sqlalchemy==1.4.14 +sqlalchemy==1.4.17 aiosqlite===0.17.0 passlib[bcrypt]==1.7.4 python-jose==3.2.0 From a6c2a3e47fb3657d64eb70e9ee298ce1355baf86 Mon Sep 17 00:00:00 2001 From: grossmj Date: Tue, 1 Jun 2021 13:02:03 +0930 Subject: [PATCH 2/2] Use synchronize_session="fetch" when updating values. --- gns3server/db/repositories/computes.py | 5 ++++- gns3server/db/repositories/templates.py | 5 ++++- gns3server/db/repositories/users.py | 10 ++++++++-- 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/gns3server/db/repositories/computes.py b/gns3server/db/repositories/computes.py index 445621da..01b5ef10 100644 --- a/gns3server/db/repositories/computes.py +++ b/gns3server/db/repositories/computes.py @@ -79,7 +79,10 @@ class ComputesRepository(BaseRepository): if password: update_values["password"] = password.get_secret_value() - query = update(models.Compute).where(models.Compute.compute_id == compute_id).values(update_values) + query = update(models.Compute).\ + where(models.Compute.compute_id == compute_id).\ + values(update_values).\ + execution_options(synchronize_session="fetch") await self._db_session.execute(query) await self._db_session.commit() diff --git a/gns3server/db/repositories/templates.py b/gns3server/db/repositories/templates.py index e5be7971..999383e0 100644 --- a/gns3server/db/repositories/templates.py +++ b/gns3server/db/repositories/templates.py @@ -70,7 +70,10 @@ class TemplatesRepository(BaseRepository): update_values = template_update.dict(exclude_unset=True) - query = update(models.Template).where(models.Template.template_id == template_id).values(update_values) + query = not update(models.Template). \ + where(models.Template.template_id == template_id). \ + values(update_values).\ + execution_options(synchronize_session="fetch") await self._db_session.execute(query) await self._db_session.commit() diff --git a/gns3server/db/repositories/users.py b/gns3server/db/repositories/users.py index c93c741e..a7047ada 100644 --- a/gns3server/db/repositories/users.py +++ b/gns3server/db/repositories/users.py @@ -80,7 +80,10 @@ class UsersRepository(BaseRepository): if password: update_values["hashed_password"] = self._auth_service.hash_password(password=password.get_secret_value()) - query = update(models.User).where(models.User.user_id == user_id).values(update_values) + query = update(models.User).\ + where(models.User.user_id == user_id).\ + values(update_values).\ + execution_options(synchronize_session="fetch") await self._db_session.execute(query) await self._db_session.commit() @@ -151,7 +154,10 @@ class UsersRepository(BaseRepository): ) -> Optional[models.UserGroup]: update_values = user_group_update.dict(exclude_unset=True) - query = update(models.UserGroup).where(models.UserGroup.user_group_id == user_group_id).values(update_values) + query = update(models.UserGroup).\ + where(models.UserGroup.user_group_id == user_group_id).\ + values(update_values).\ + execution_options(synchronize_session="fetch") await self._db_session.execute(query) await self._db_session.commit()