@gravity-ui/gateway 4.7.1 → 4.7.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/components/grpc.js +9 -3
- package/package.json +1 -1
package/build/components/grpc.js
CHANGED
|
@@ -327,6 +327,12 @@ async function getResponseData({ config, response, ctx, packageRoot, args, Error
|
|
|
327
327
|
}
|
|
328
328
|
return responseData;
|
|
329
329
|
}
|
|
330
|
+
// Function to generate fresh serviceOptions with updated deadline for each attempt
|
|
331
|
+
function createServiceOptions(timeout) {
|
|
332
|
+
return {
|
|
333
|
+
deadline: Date.now() + timeout,
|
|
334
|
+
};
|
|
335
|
+
}
|
|
330
336
|
function createGrpcAction({ root, credentials }, endpoints, config, serviceKey, actionName, options, ErrorConstructor) {
|
|
331
337
|
const serviceName = (options === null || options === void 0 ? void 0 : options.serviceName) || serviceKey;
|
|
332
338
|
let getService;
|
|
@@ -504,9 +510,7 @@ function createGrpcAction({ root, credentials }, endpoints, config, serviceKey,
|
|
|
504
510
|
});
|
|
505
511
|
}
|
|
506
512
|
const timeout = (_c = (_b = (_a = actionConfig === null || actionConfig === void 0 ? void 0 : actionConfig.timeout) !== null && _a !== void 0 ? _a : config === null || config === void 0 ? void 0 : config.timeout) !== null && _b !== void 0 ? _b : options === null || options === void 0 ? void 0 : options.timeout) !== null && _c !== void 0 ? _c : constants_1.DEFAULT_TIMEOUT;
|
|
507
|
-
|
|
508
|
-
deadline: Date.now() + timeout,
|
|
509
|
-
};
|
|
513
|
+
let serviceOptions = createServiceOptions(timeout);
|
|
510
514
|
const { body = null } = params !== null && params !== void 0 ? params : { body: args };
|
|
511
515
|
const serviceMetadata = createMetadata({
|
|
512
516
|
options,
|
|
@@ -655,6 +659,8 @@ function createGrpcAction({ root, credentials }, endpoints, config, serviceKey,
|
|
|
655
659
|
stopListeningForAbort === null || stopListeningForAbort === void 0 ? void 0 : stopListeningForAbort();
|
|
656
660
|
// Update service
|
|
657
661
|
actionCall = service[action].bind(service);
|
|
662
|
+
// Update serviceOptions with a fresh deadline for the retry
|
|
663
|
+
serviceOptions = createServiceOptions(timeout);
|
|
658
664
|
callAction();
|
|
659
665
|
return;
|
|
660
666
|
}
|