DefaultReconnectPolicy.js 822 B

123456789101112131415161718
  1. "use strict";
  2. // Licensed to the .NET Foundation under one or more agreements.
  3. // The .NET Foundation licenses this file to you under the MIT license.
  4. Object.defineProperty(exports, "__esModule", { value: true });
  5. exports.DefaultReconnectPolicy = void 0;
  6. // 0, 2, 10, 30 second delays before reconnect attempts.
  7. const DEFAULT_RETRY_DELAYS_IN_MILLISECONDS = [0, 2000, 10000, 30000, null];
  8. /** @private */
  9. class DefaultReconnectPolicy {
  10. constructor(retryDelays) {
  11. this._retryDelays = retryDelays !== undefined ? [...retryDelays, null] : DEFAULT_RETRY_DELAYS_IN_MILLISECONDS;
  12. }
  13. nextRetryDelayInMilliseconds(retryContext) {
  14. return this._retryDelays[retryContext.previousRetryCount];
  15. }
  16. }
  17. exports.DefaultReconnectPolicy = DefaultReconnectPolicy;
  18. //# sourceMappingURL=DefaultReconnectPolicy.js.map