Skip to content
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

refactor: reconnect even if we failed to start transport #12

Merged
merged 3 commits into from
Dec 20, 2023

Conversation

deleteLater
Copy link
Contributor

@deleteLater deleteLater commented Dec 19, 2023

We should try to reconnect even we failed to start initially.

fixed #11

Example running log

info: FeatBit.Sdk.Server.FbClient[0]
      Starting FbClient...
info: FeatBit.Sdk.Server.FbClient[0]
      Waiting up to 3000 milliseconds for FbClient to start...
fail: FeatBit.Sdk.Server.FbClient[0]
      FbClient failed to start successfully within 3000 milliseconds. This error usually indicates a connection issue with FeatBit or an invalid secret. Please double-check your EnvSecret and StreamingUri configuration.
warn: FeatBit.Sdk.Server.Transport.FbWebSocket[16]
      FbWebSocket is trying to reconnect. Flag evaluation results may be stale until reconnected.
info: FeatBit.Sdk.Server.Transport.FbWebSocket[18]
      Reconnect attempt number 0 will start in 00:00:00.
info: Microsoft.Hosting.Lifetime[14]
      Now listening on: http://localhost:5014
info: Microsoft.Hosting.Lifetime[0]
      Application started. Press Ctrl+C to shut down.
info: Microsoft.Hosting.Lifetime[0]
      Hosting environment: Development
info: Microsoft.Hosting.Lifetime[0]
      Content root path: D:\Work\featbit-sdks\dotnet-server-sdk\examples\WebApiApp\
info: FeatBit.Sdk.Server.Transport.FbWebSocket[18]
      Reconnect attempt number 1 will start in 00:00:01.
info: FeatBit.Sdk.Server.Transport.FbWebSocket[18]
      Reconnect attempt number 2 will start in 00:00:02.
info: FeatBit.Sdk.Server.Transport.FbWebSocket[18]
      Reconnect attempt number 3 will start in 00:00:03.
info: FeatBit.Sdk.Server.Transport.FbWebSocket[7]
      FbWebSocket started.
info: FeatBit.Sdk.Server.Transport.FbWebSocket[20]
      FbWebSocket reconnected successfully after 3 attempts and 00:00:19.6971031 elapsed.

@deleteLater deleteLater self-assigned this Dec 19, 2023
@deleteLater deleteLater added the enhancement New feature or request label Dec 19, 2023
@leachdaniel-clark
Copy link

leachdaniel-clark commented Dec 19, 2023

I've built this branch locally and manually tested with a disabled network interface that it will connect and do the data sync once the network is fixed:

12:11:30 -> warn: FeatBit.Sdk.Server.Transport.FbWebSocket[16]
      FbWebSocket is trying to reconnect. Flag evaluation results may be stale until reconnected.
12:11:34 -> fail: FeatBit.Sdk.Server.FbClient[0]
      FbClient failed to start successfully within 5000 milliseconds. This error usually indicates a connection issue with FeatBit or an invalid secret. Please double-check your EnvSecret and StreamingUri configuration.
12:12:24 -> dbug: FeatBit.Sdk.Server.DataSynchronizer.WebSocketDataSynchronizer[0]
      Do data-sync with version: 0
12:12:25 -> dbug: FeatBit.Sdk.Server.DataSynchronizer.WebSocketDataSynchronizer[0]
      Received full data-sync message

@wss-rbrennan
Copy link

LGTM

@deleteLater deleteLater merged commit 052e862 into main Dec 20, 2023
1 check passed
@deleteLater deleteLater deleted the fix/reconnect-if-failed-to-connect-initially branch December 20, 2023 11:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

🐛BUG: Featbit SDK will not retry connection to eval server
3 participants