Skip to content

Commit

Permalink
retry improvements (#165)
Browse files Browse the repository at this point in the history
  • Loading branch information
Luke Gehorsam authored Nov 21, 2023
1 parent 3e1d332 commit 07b6a42
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 2 deletions.
8 changes: 8 additions & 0 deletions Packages/Nakama/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,14 @@ All notable changes to this project are documented below.

The format is based on [keep a changelog](http://keepachangelog.com/) and this project uses [semantic versioning](http://semver.org/).

### [Unreleased]

## [3.10.0] - 2023-11-21

### Changed
- Updated to use the Nakama and Satori .NET 3.9.0 release.
- Restricted retry attempts to more specific 500-level error codes from the server.

## [3.9.0] - 2023-08-11
### Changed
- Updated to use the Nakama and Satori .NET 3.9.0 release.
Expand Down
Binary file modified Packages/Nakama/Runtime/Plugins/Nakama.dll
Binary file not shown.
Binary file modified Packages/Nakama/Runtime/Plugins/Satori.dll
Binary file not shown.
14 changes: 13 additions & 1 deletion Packages/Nakama/Runtime/UnityWebRequestAdapter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,19 @@ private static bool IsNetworkError(UnityWebRequest www)

private static bool IsTransientException(Exception e)
{
return e is ApiResponseException apiException && (apiException.StatusCode >= 500 || apiException.StatusCode == -1);
if (e is ApiResponseException apiException)
{
switch (apiException.StatusCode)
{
case 500: // Internal Server Error often (but not always) indicates a transient issue in Nakama, e.g., DB connectivity.
case 502: // LB returns this to client if server sends corrupt/invalid data to LB, which may be a transient issue.
case 503: // LB returns this to client if LB determines or is told that server is unable to handle forwarded from LB, which may be a transient issue.
case 504: // LB returns this to client if LB cannot communicate with server, which may be a temporary issue.
return true;
}
}

return false;
}
}
}
2 changes: 1 addition & 1 deletion Packages/Nakama/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "com.heroiclabs.nakama-unity",
"version": "3.9.0",
"version": "3.10.0",
"unity": "2018.4",
"displayName": "Nakama Unity",
"description": "Unity3D client for Nakama server written in C#.",
Expand Down

0 comments on commit 07b6a42

Please sign in to comment.