Skip to content

Commit 4f7edeb

Browse files
Adds feature flag check for realtime collaboration updates
Guards document update notifications with a configuration check to ensure updates are sent only when realtime collaboration is enabled. Prevents unnecessary operations and aligns with feature toggling.
1 parent 19e3d7a commit 4f7edeb

File tree

2 files changed

+31
-24
lines changed

2 files changed

+31
-24
lines changed

services/web/server/src/simcore_service_webserver/projects/_projects_repository_legacy.py

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@
7575
from tenacity.asyncio import AsyncRetrying
7676
from tenacity.retry import retry_if_exception_type
7777

78+
from ..application_settings import get_application_settings
7879
from ..models import ClientSessionID
7980
from ..utils import now_str
8081
from ._comments_repository import (
@@ -957,19 +958,23 @@ async def _update_project_workbench_with_lock_and_notify(
957958
allow_workbench_changes=allow_workbench_changes,
958959
)
959960

960-
(
961-
project_document,
962-
document_version,
963-
) = await create_project_document_and_increment_version(self._app, project_uuid)
961+
app_settings = get_application_settings(self._app)
962+
if app_settings.WEBSERVER_REALTIME_COLLABORATION is not None:
963+
(
964+
project_document,
965+
document_version,
966+
) = await create_project_document_and_increment_version(
967+
self._app, project_uuid
968+
)
964969

965-
await notify_project_document_updated(
966-
app=self._app,
967-
project_id=project_uuid,
968-
user_primary_gid=user_primary_gid,
969-
client_session_id=client_session_id,
970-
version=document_version,
971-
document=project_document,
972-
)
970+
await notify_project_document_updated(
971+
app=self._app,
972+
project_id=project_uuid,
973+
user_primary_gid=user_primary_gid,
974+
client_session_id=client_session_id,
975+
version=document_version,
976+
document=project_document,
977+
)
973978
return updated_project, changed_entries
974979

975980
async def _update_project_workbench(

services/web/server/src/simcore_service_webserver/projects/_projects_service.py

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -205,18 +205,20 @@ async def patch_project_and_notify_users(
205205
new_partial_project_data=patch_project_data,
206206
)
207207

208-
(
209-
project_document,
210-
document_version,
211-
) = await create_project_document_and_increment_version(app, project_uuid)
212-
await notify_project_document_updated(
213-
app=app,
214-
project_id=project_uuid,
215-
user_primary_gid=user_primary_gid,
216-
client_session_id=client_session_id,
217-
version=document_version,
218-
document=project_document,
219-
)
208+
app_settings = get_application_settings(app)
209+
if app_settings.WEBSERVER_REALTIME_COLLABORATION is not None:
210+
(
211+
project_document,
212+
document_version,
213+
) = await create_project_document_and_increment_version(app, project_uuid)
214+
await notify_project_document_updated(
215+
app=app,
216+
project_id=project_uuid,
217+
user_primary_gid=user_primary_gid,
218+
client_session_id=client_session_id,
219+
version=document_version,
220+
document=project_document,
221+
)
220222

221223

222224
def _is_node_dynamic(node_key: str) -> bool:

0 commit comments

Comments
 (0)