AutoRetryClusterTopClient.cs 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. using Top.Api.Cluster;
  2. namespace Top.Api
  3. {
  4. public class AutoRetryClusterTopClient : AutoRetryTopClient
  5. {
  6. public AutoRetryClusterTopClient(string serverUrl, string appKey, string appSecret)
  7. : base(serverUrl, appKey, appSecret)
  8. {
  9. ClusterManager.InitRefreshThread(this);
  10. }
  11. public AutoRetryClusterTopClient(string serverUrl, string appKey, string appSecret, string format)
  12. : base(serverUrl, appKey, appSecret, format)
  13. {
  14. ClusterManager.InitRefreshThread(this);
  15. }
  16. internal override string GetServerUrl(string serverUrl, string apiName, string session)
  17. {
  18. DnsConfig dnsConfig = ClusterManager.GetDnsConfigFromCache();
  19. if (dnsConfig == null)
  20. {
  21. return serverUrl;
  22. }
  23. else
  24. {
  25. return dnsConfig.GetBestVipUrl(serverUrl, apiName, session);
  26. }
  27. }
  28. internal override string GetSdkVersion()
  29. {
  30. return Constants.SDK_VERSION_CLUSTER;
  31. }
  32. }
  33. }