I'm attempting to increase the value of WEB_CONCUR...
# ask-community
a
I'm attempting to increase the value of WEB_CONCURRENCY in order the support higher load for a given prefect server, and running into errors that come from these two lines, which run into a race condition between the various processes trying to run database migrations and register the "block types" the first time the server starts up: https://github.com/PrefectHQ/prefect/blob/3.1.11/src/prefect/server/api/server.py#L629-L630 A basic reproduction of the issue would be:
Copy code
WEB_CONCURRENCY=2 PREFECT_API_DATABASE_CONNECTION_URL='sqlite+aiosqlite:////tmp/prefect-test.db' prefect server start
and if you initialize the database first with
prefect server database upgrade -y
and then set
PREFECT_API_DATABASE_MIGRATE_ON_START='False'
a similar error occurs for the block type. The issue happens for a Postgres database as well. I've not been able to find a way to disable auto-registration of the block types and manually do it ahead of time. Is there a workaround for this, or more broadly could Prefect be enhanced to better support these init operations within multiple workers running at once for the server?