Skip to content

refactor: move socket creation and management to App module#4713

Merged
steve-chavez merged 1 commit intoPostgREST:mainfrom
mkleczek:refactor/move-socket-init-to-app-module
Mar 12, 2026
Merged

refactor: move socket creation and management to App module#4713
steve-chavez merged 1 commit intoPostgREST:mainfrom
mkleczek:refactor/move-socket-init-to-app-module

Conversation

@mkleczek
Copy link
Copy Markdown
Collaborator

@mkleczek mkleczek commented Mar 12, 2026

DISCLAIMER:
This commit was authored entirely by a human without the assistance of LLMs.

Right now listening sockets initialization, management and usage is split between App, AppState and Admin modules: they are created in AppState.init and remembered in AppState but used only in App and Admin.

It has several negative consequences:

  • sockets are initialized even if not needed (eg. command line invocations like dump-config or dump-schema)
  • it is impossible to start listening on a socket after initial schema cache load because it requires AppState

This change decouples listen socket management from AppState. Sockets are created only when needed (ie. not in command line tools invocation) and passed to admin application and to Warp by the App module.

Prerequisite of: #4702 #4703

Right now listening sockets initialization, management and usage is split between App, AppState and Admin modules: they are created in AppState.init and remembered in AppState but used only in App and Admin.

It has several negative consequences:
- sockets are initialized even if not needed (eg. command line invocations like dump-config or dump-schema)
- it is impossible to start listening on a socket after initial schema cache load because it requires AppState

This change decouples listen socket management from AppState. Sockets are created only when needed (ie. not in command line tools invocation) and passed to admin application and to Warp by the App module.
Copy link
Copy Markdown
Member

@steve-chavez steve-chavez left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense. Change looks good, only moving code from what I can see. 👍

@steve-chavez steve-chavez merged commit a4aa58b into PostgREST:main Mar 12, 2026
32 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants