Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR refactors the application architecture by consolidating state management into a single AppState struct and separating proxy logic from the main server module.
- Creates a centralized
AppStatestruct to manage database pools, job cache, worker health, and configuration - Extracts cache management functionality into a dedicated
cachemodule - Moves PostgreSQL proxy startup logic from main server to the proxy crate
Reviewed Changes
Copilot reviewed 11 out of 12 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| server/src/app_state.rs | New centralized application state management struct |
| server/src/cache.rs | Extracted cache synchronization and job notification logic |
| server/src/main.rs | Simplified main function using new AppState pattern |
| server/src/routes/*.rs | Updated route handlers to use AppState instead of individual dependencies |
| proxy/src/proxy.rs | Added proxy startup function moved from server main |
| */Cargo.toml | Updated tracing dependencies to use workspace versions |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
|
|
||
| let url = Url::parse(&database_url)?; | ||
| let postgres_host = url.host_str().unwrap(); | ||
| let postgres_port = url.port().unwrap(); |
There was a problem hiding this comment.
Using unwrap() on URL parsing results can cause panics. Consider using proper error handling with meaningful error messages for when host or port are missing from the URL.
Suggested change
| let postgres_port = url.port().unwrap(); | |
| let postgres_port = url | |
| .port() | |
| .ok_or("Database URL is missing a port")?; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
proxylogic fromserver