Skip to content

Timeout implementation #163

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 19 commits into from
May 27, 2025
Merged

Timeout implementation #163

merged 19 commits into from
May 27, 2025

Conversation

RicardRC
Copy link
Contributor

No description provided.

redbaron and others added 13 commits October 10, 2024 13:43
First draft of generated satori cpp api

Generate cpp grpcs for satori client

Generalize git submodule urls

wip satori grpc client and test

Revert "Merge remote-tracking branch 'origin/private-build-rules' into satori-client-cpp"

WIP build test

Add dir tree to satori cmake

generate cpp api

First draft of generated satori cpp api

Generate cpp grpcs for satori client

Fix libhttpclient builds, rearrange build scripts for easier console builds

Private build fixups

protobuf + abseil PS5 wip

All dependencies built

wslay port added

NDAed platforms build refactor

Fix private builds factory methods

Sync protobuf verion in public and private builds

Remove unnecesasry compile definition

libhttpclient build fixes

Windows: align project and vcpkg deps on toolchain used. Fix wslay builds.

Update to latest libHttpClient  and provide build script for it.

Also simplify bunch of build instructions

switch to upstream libhttpclient

Use aliases where possible for safety, cleanup libhttpclient build scripts

GDK support for libhttpclient transport

Use winhttp (via libhttpclient) on Windows

Mac OSX Universal binary

Update CHANGELOG.md

Fix iOS builds

Fix iphonesimulator builds

Fix Linux builds

Accurately list transports in README.md

Generalize git submodule urls

wip satori grpc client and test

Revert "Merge remote-tracking branch 'origin/private-build-rules' into satori-client-cpp"

WIP build test

cmake minor fixes wip

generate cpp api

First draft of generated satori cpp api

Generate cpp grpcs for satori client

Generalize git submodule urls

wip satori grpc client and test

Revert "Merge remote-tracking branch 'origin/private-build-rules' into satori-client-cpp"

WIP build test

Add dir tree to satori cmake

generate cpp api

First draft of generated satori cpp api

Generate cpp grpcs for satori client

Fix libhttpclient builds, rearrange build scripts for easier console builds

Private build fixups

protobuf + abseil PS5 wip

All dependencies built

wslay port added

NDAed platforms build refactor

Fix private builds factory methods

Sync protobuf verion in public and private builds

Remove unnecesasry compile definition

libhttpclient build fixes

Windows: align project and vcpkg deps on toolchain used. Fix wslay builds.

Update to latest libHttpClient  and provide build script for it.

Also simplify bunch of build instructions

switch to upstream libhttpclient

Use aliases where possible for safety, cleanup libhttpclient build scripts

GDK support for libhttpclient transport

Use winhttp (via libhttpclient) on Windows

Mac OSX Universal binary

Update CHANGELOG.md

Fix iOS builds

Fix iphonesimulator builds

Fix Linux builds

Accurately list transports in README.md

Generalize git submodule urls

wip satori grpc client and test

Revert "Merge remote-tracking branch 'origin/private-build-rules' into satori-client-cpp"

WIP build test

cmake minor fixes wip

wip setup cmake

add
Add additional info to Satori Call Get Flags.
More defensive json parsing.
@RicardRC RicardRC marked this pull request as ready for review March 16, 2025 15:05
@RicardRC RicardRC requested a review from redbaron March 16, 2025 15:05
@redbaron redbaron changed the base branch from master to private-build-rules March 17, 2025 09:29
@redbaron
Copy link
Contributor

I have changed base of this PR to more accurately reflect what is being changed

…ded' into timeout-impl

# Conflicts:
#	CMakeLists.txt
@RicardRC
Copy link
Contributor Author

Client needs satori, so this branch now pulls in the full satori implementation too. I've not changed anything else from the original PR besides commit [555b2c4], but it's not substantial, only a rearrangement and what is necessary to get timeouts inside satori as well.

Copy link
Contributor

Choose a reason for hiding this comment

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

cpprestsdk can probably go, AFAIK it is not used on any platform by default anymore

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, it's not used anywhere. I will remove it on another PR, though, I don't want to cram this one with even more changes.

@RicardRC RicardRC requested a review from Copilot May 27, 2025 22:35
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR primarily focuses on the timeout implementation for HTTP clients and ensures that all endpoint URL parameters are properly encoded. Key changes include:

  • Introducing a timeout check in the RestClient creation within the ClientFactory.
  • Wrapping various URL parameters with encodeURIComponent in RestClient methods.
  • Adjusting default member initializations in BaseClient and updating the Java package in AndroidCA.

Reviewed Changes

Copilot reviewed 45 out of 61 changed files in this pull request and generated 1 comment.

File Description
factory/ClientFactory.cpp Adds a timeout implementation in createRestClient and reformats header includes.
core/core-rest/RestClient.cpp Wraps URL parameters with encodeURIComponent for safe URL composition.
core/common/BaseClient.h Sets a default value for _port and adjusts member ordering for consistency.
android/nativelib/src/main/java/com/heroiclabs/nakama/AndroidCA.java Updates package naming and removes unused certificate imports.
Files not reviewed (16)
  • CMakeLists.txt: Language not supported
  • CMakePresets.json: Language not supported
  • android/app/build.gradle: Language not supported
  • android/build.gradle.kts: Language not supported
  • android/gradle.properties: Language not supported
  • android/gradle/wrapper/gradle-wrapper.properties: Language not supported
  • android/nativelib/build.gradle.kts: Language not supported
  • android/nativelib/src/main/AndroidManifest.xml: Language not supported
  • android/settings.gradle: Language not supported
  • android/settings.gradle.kts: Language not supported
  • cmake/triplets/arm64-v8a-android-heroic.cmake: Language not supported
  • cmake/triplets/armeabi-v7a-android-heroic.cmake: Language not supported
  • cmake/triplets/x86-64-android-heroic.cmake: Language not supported
  • cmake/triplets/x86-android-heroic.cmake: Language not supported
  • core/buildProtoFiles.cmake: Language not supported
  • factory/CMakeLists.txt: Language not supported
Comments suppressed due to low confidence (1)

factory/ClientFactory.cpp:63

  • Verify that using '>= 0' for the timeout check is intentional and that a timeout of 0 is meant to be applied to the HTTP transport; if a non-operational timeout is not desired, consider using '> 0' instead.
if (parameters.timeout >= std::chrono::milliseconds(0)) {

@@ -476,12 +476,12 @@ namespace Nakama {
) override;

protected:
int _port;
std::string _host;
int _port = -1;
Copy link
Preview

Copilot AI May 27, 2025

Choose a reason for hiding this comment

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

[nitpick] Consider using a named constant (e.g., DEFAULT_PORT) instead of the magic number -1 to improve clarity and maintainability.

Suggested change
int _port = -1;
static constexpr int DEFAULT_PORT = -1;
int _port = DEFAULT_PORT;

Copilot uses AI. Check for mistakes.

@RicardRC RicardRC merged commit b132025 into private-build-rules May 27, 2025
1 of 2 checks passed
@RicardRC RicardRC deleted the timeout-impl branch May 27, 2025 23:18
redbaron added a commit that referenced this pull request Jul 17, 2025
Add ability to set timeouts to the rest api (milliseconds for the backends that support that much granularity, seconds for the ones that do not).
---------

Co-authored-by: Maxim Ivanov <[email protected]>
Co-authored-by: Maxim Ivanov <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants