Skip to content

Transferring data from old session to new does not work #235

@tnatt

Description

@tnatt

In the endpoint to create a new session POST /session there is logic to transfer relevant data from an existing session to a new one.
This does not work and no data is transferred to the new session.

The reason is that the SessionManager.get_session method will trigger a destroyal of the old session and raises a SessionNotFoundError if a session has expired.

if session.expires_at < now:
await self.destroy_session(session_id)
raise SessionNotFoundError("Invalid or expired session")

Hence the exception here is suppressed and the old_session variable is never defined and stays None. The old_session value is used in turn to check if data should be transferred.

if fmu_settings_session:
with contextlib.suppress(Exception):
old_session = await session_manager.get_session(
fmu_settings_session, extend_expiration=False
)

Existing tests does not pick up on it since we are testing to transfer data between a non-expired session to a new one, hence we do not trigger the SessionNotFoundError.

Metadata

Metadata

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions