Repository navigation
Enhance sender task structure and improve task management - #163
Merged
Merged
Conversation
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.
This pull request introduces several improvements and refactorings across the backend, focusing on PostgreSQL connection pool configurability, code quality, and minor API ergonomics. The most significant changes are the introduction of a configurable PostgreSQL pool with environment variable overrides, enhancements to CI checks, and code cleanups leveraging Rust's newer control flow syntax.
Database configuration and ergonomics:
PgPoolConfigstruct inbackend/crates/repository/src/postgres.rsto allow fine-grained configuration of PostgreSQL connection pool parameters, supporting both API and worker presets, and environment variable overrides for all options. ([backend/crates/repository/src/postgres.rsL16-R158](https://github.com/Flash303/minecraft-stats/pull/163/files#diff-46eb215b827b58c2dca6c0215c910f3e1e34d6da3a0bf7a92bf567a57987bb6fL16-R158))PostgresRepositoryto support initialization with custom pool configuration, and updated the REST API entrypoint to use the new configuration mechanism. ([[1]](https://github.com/Flash303/minecraft-stats/pull/163/files#diff-46eb215b827b58c2dca6c0215c910f3e1e34d6da3a0bf7a92bf567a57987bb6fR169-R185),[[2]](https://github.com/Flash303/minecraft-stats/pull/163/files#diff-2d7afa57cd8a5b308e9974aa8c48235b4246cbd7c470c274369b3a1ed08bd721L21-R21),[[3]](https://github.com/Flash303/minecraft-stats/pull/163/files#diff-2d7afa57cd8a5b308e9974aa8c48235b4246cbd7c470c274369b3a1ed08bd721L54-R56)).env.example. ([backend/rest-api/.env.exampleR3-R8](https://github.com/Flash303/minecraft-stats/pull/163/files#diff-e9a8e7a2630720ab0c2d79e754e34e8a4298777feeb69df2e4bf8322fc7bbe9dR3-R8))Continuous Integration improvements:
.github/workflows/ci.yml) to check that generated service worker files are up to date before building, and added Rust formatting and Clippy lints to the backend workflow, enforcing stricter code quality. ([.github/workflows/ci.ymlR36-R65](https://github.com/Flash303/minecraft-stats/pull/163/files#diff-b803fcb7f17ed9235f1e5cb1fcd2f5d3b2838429d4368ae4c57ce4436577f03fR36-R65))Rust code quality and modern syntax:
[[1]](https://github.com/Flash303/minecraft-stats/pull/163/files#diff-da909813f4a9002d62abd0aa2883554c2cfa40634bb007cffcd0af5b34e76fbaL208-L247),[[2]](https://github.com/Flash303/minecraft-stats/pull/163/files#diff-6fc865c8bfd6ec7c5f186cf219668282275b6fe3c63a6eebf81a4e7f1225c565R24-L25),[[3]](https://github.com/Flash303/minecraft-stats/pull/163/files#diff-4cf94b42294b15de4dfbd6c4c0108a717492062b61b56fcae3dc544ecbdca699L183-L187),[[4]](https://github.com/Flash303/minecraft-stats/pull/163/files#diff-758c91bbfa86215950de7a4d4f660b8b4d80909b0b0a4f4a22b0376b081ae289L37-L51))Defaultimplementation forTtlCacheto simplify cache instantiation. ([backend/rest-api/src/utils/cache.rsR16-R25](https://github.com/Flash303/minecraft-stats/pull/163/files#diff-758c91bbfa86215950de7a4d4f660b8b4d80909b0b0a4f4a22b0376b081ae289R16-R25))Minor API and code ergonomics:
save_pingsmethod in theRepositorytrait and its implementation to accept a slice (&[Record]) instead of a reference to aVec, improving flexibility. ([[1]](https://github.com/Flash303/minecraft-stats/pull/163/files#diff-65309160936c8100b25422230b386e5423926e6ff3ee5678e76c5775ecce7c73L18-R18),[[2]](https://github.com/Flash303/minecraft-stats/pull/163/files#diff-46eb215b827b58c2dca6c0215c910f3e1e34d6da3a0bf7a92bf567a57987bb6fL50-R201))backend/rest-api/src/error.rs. ([[1]](https://github.com/Flash303/minecraft-stats/pull/163/files#diff-ed129d15399df47d91a647fdc1b8a0257a0cdd9f0c54f8bdc543384135774032L88-L108),[[2]](https://github.com/Flash303/minecraft-stats/pull/163/files#diff-ed129d15399df47d91a647fdc1b8a0257a0cdd9f0c54f8bdc543384135774032R136-R156))Other improvements:
[[1]](https://github.com/Flash303/minecraft-stats/pull/163/files#diff-2d7afa57cd8a5b308e9974aa8c48235b4246cbd7c470c274369b3a1ed08bd721L63-R65),[[2]](https://github.com/Flash303/minecraft-stats/pull/163/files#diff-2d7afa57cd8a5b308e9974aa8c48235b4246cbd7c470c274369b3a1ed08bd721L80-R87),[[3]](https://github.com/Flash303/minecraft-stats/pull/163/files#diff-aaaedb419c10450d5682f996bae006519d4169dd87f3eb0bfe63de55391775d8L33-R33),[[4]](https://github.com/Flash303/minecraft-stats/pull/163/files#diff-522a5296124462e42be9c0afe3306c936fd7ab34d49417eca3b1237c94715e4aL14-R14),[[5]](https://github.com/Flash303/minecraft-stats/pull/163/files#diff-73824bc2f5aefa283d0f1ab4eb735df1031d9871fb7d5be90de3a5d376c9c0faR17))These changes collectively improve code maintainability, configuration flexibility, and quality assurance for the backend.