neonize icon indicating copy to clipboard operation
neonize copied to clipboard

Run Neonize in FastApi with multi workers

Open elsayedmohamed2020 opened this issue 9 months ago • 2 comments

Hello,

I have created an API using Neonize with the FastAPI framework. However, I am facing an issue when running the FastAPI server with more than one worker process.

The problem is related to the dictionary clients = {} that I use to store client sessions. When the server runs with multiple workers, each worker maintains its own separate memory space, so the clients dictionary is not shared across workers. As a result, the workers cannot see or access the clients stored in other workers’ dictionaries.

This causes inconsistencies and breaks functionality that relies on shared client data.

Could you help me fix this issue or suggest a better approach for managing client sessions across multiple FastAPI workers?

elsayedmohamed2020 avatar May 19 '25 02:05 elsayedmohamed2020