#2236 feat: add server-side retry configuration for remote database commands#2255
#2236 feat: add server-side retry configuration for remote database commands#2255
Conversation
There was a problem hiding this comment.
Summary of Changes
Hello @robfrank, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!
This pull request adds the capability to configure the number of retries for remote HTTP database commands via a global configuration setting. The RemoteHttpComponent now reads this setting and includes it in the command request payload, providing the server with the client's desired retry count. Associated tests have been updated to demonstrate and verify this new configuration option.
Highlights
- Configurable Retries: Introduced a
retriesfield inRemoteHttpComponentto store the number of retry attempts for HTTP commands, initialized from theGlobalConfiguration.TX_RETRIESsetting. - Retry Count in Payload: Modified the
httpCommandmethod to include the configuredretriesvalue in the JSON request payload sent to the server, allowing the server-side to potentially utilize this information. - Test Updates: Updated
RemoteDatabaseJavaApiITto configureGlobalConfiguration.TX_RETRIESviaContextConfigurationwhen creating theRemoteDatabaseinstance, ensuring the new retry setting is tested.
Using Gemini Code Assist
The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.
Invoking Gemini
You can request assistance from Gemini at any point in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.
| Feature | Command | Description |
|---|---|---|
| Code Review | /gemini review |
Performs a code review for the current pull request in its current state. |
| Pull Request Summary | /gemini summary |
Provides a summary of the current pull request in its current state. |
| Comment | @gemini-code-assist | Responds in comments when explicitly tagged, both in issue comments and review comments. |
| Help | /gemini help |
Displays a list of available commands. |
Customization
To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.
Limitations & Feedback
Gemini Code Assist is currently in preview and may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments to provide feedback.
You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.
Footnotes
-
Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configureGemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution. ↩
There was a problem hiding this comment.
Code Review
This pull request introduces a server-side retry configuration for remote database commands. The client-side RemoteHttpComponent is updated to send a retries parameter in the JSON payload, and tests are modified to include this new configuration. The changes appear to correctly implement the described feature. The review includes suggestions to improve maintainability by using a constant for a JSON key and replacing a debug print statement with proper logging.
| jsonRequest.put("language", language); | ||
| jsonRequest.put("command", payloadCommand); | ||
| jsonRequest.put("serializer", "record"); | ||
| jsonRequest.put("retries", retries); |
There was a problem hiding this comment.
The JSON key "retries" is used here as a literal string. Consider defining this as a public static final String constant, for example, within this class or a shared constants class. This improves maintainability by centralizing the key definition, making it easier to update if needed and reducing the risk of typos if the key is used in multiple places (e.g., client and server-side parsing).
Coverage summary from CodacySee diff coverage on Codacy
Coverage variation details
Coverage variation is the difference between the coverage for the head and common ancestor commits of the pull request branch: Diff coverage details
Diff coverage is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified: See your quality gate settings Change summary preferences |
lvca
left a comment
There was a problem hiding this comment.
Perfect, just a debug leftover to remove
This pull request introduces improvements to the
RemoteHttpComponentclass, adds retry logic for HTTP commands, and updates test cases to accommodate the new configuration option. The most notable changes include the addition of aretriesparameter, modifications to thehttpCommandmethod, and updates to the test setup for retry configuration.Enhancements to
RemoteHttpComponent:retriesfield to the class, initialized from theContextConfigurationto allow configurable retry attempts for HTTP commands. (network/src/main/java/com/arcadedb/remote/RemoteHttpComponent.java) [1] [2]httpCommandmethod to include theretriesparameter in the JSON request payload for better control over transaction retries. (network/src/main/java/com/arcadedb/remote/RemoteHttpComponent.java)(
network/src/main/java/com/arcadedb/remote/RemoteHttpComponent.java)Test updates for retry configuration:
RemoteDatabaseJavaApiITtest to include aContextConfigurationsetup with theTX_RETRIESparameter, ensuring the retry logic is properly tested. (server/src/test/java/com/arcadedb/remote/RemoteDatabaseJavaApiIT.java)HTTPGraphITto log the response for troubleshooting purposes. (server/src/test/java/com/arcadedb/server/HTTPGraphIT.java)Dependency adjustments:
RemoteDatabaseand test files to reflect changes in used classes and packages. (network/src/main/java/com/arcadedb/remote/RemoteDatabase.java,server/src/test/java/com/arcadedb/remote/RemoteDatabaseJavaApiIT.java) [1] [2]