UNPKG

wechaty-puppet-service

Version:
36 lines 1.57 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.recoverEpic = void 0; /** * Wechaty Open Source Software - https://github.com/wechaty * * @copyright 2016 Huan LI (李卓桓) <https://github.com/huan>, and * Wechaty Contributors <https://github.com/wechaty>. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ const rxjs_1 = require("rxjs"); const epic_recover_js_1 = require("./epic-recover.js"); /** * The GRPC keepalive timeout is 20 seconds * So we use 15 seconds to save the GRPC keepalive cost * * https://github.com/grpc/grpc/blob/master/doc/keepalive.md * GRPC_ARG_KEEPALIVE_TIMEOUT_MS 20000 (20 seconds) 20000 (20 seconds) */ const TIMEOUT_SOFT = 15 * 1000; const TIMEOUT_HARD = Math.floor(4.5 * TIMEOUT_SOFT); const recoverEpic = (action$) => (0, rxjs_1.merge)((0, epic_recover_js_1.epicRecoverDing$)(TIMEOUT_SOFT)(action$), (0, epic_recover_js_1.epicRecoverReset$)(TIMEOUT_HARD)(action$)); exports.recoverEpic = recoverEpic; //# sourceMappingURL=epics.js.map