@ductape/sdk 0.2.7 → 0.2.8
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/dist/index.d.ts +2 -1
- package/dist/index.js +28 -2
- package/dist/index.js.map +1 -1
- package/dist/processor/services/processor.service.d.ts +1 -0
- package/dist/processor/services/processor.service.js +14 -5
- package/dist/processor/services/processor.service.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
|
@@ -317,6 +317,7 @@ export default class ProcessorService implements IProcessorService {
|
|
|
317
317
|
data?: undefined;
|
|
318
318
|
}>;
|
|
319
319
|
processPricingCost(additional_logs: Partial<ILogData>): Promise<IPricingResult>;
|
|
320
|
+
private processPricingCostEventually;
|
|
320
321
|
addToSuccessOutput(event: IStepEvent, output: any, additional_logs: Partial<ILogData>): Promise<void>;
|
|
321
322
|
checkIsSuccessful(): boolean;
|
|
322
323
|
addToFailureOutput(e: any, event: IStepEvent, payload: IRetryMeta | any, additional_logs: Partial<ILogData>, policy?: Partial<IAppRetryPolicy>): Promise<IProcessingFailure>;
|
|
@@ -2956,13 +2956,12 @@ class ProcessorService {
|
|
|
2956
2956
|
const end = Date.now();
|
|
2957
2957
|
this.requestTime += end - start;
|
|
2958
2958
|
this.totalRequests += 1;
|
|
2959
|
-
|
|
2959
|
+
// Pricing/request accounting can touch Redis (including lock acquisition and
|
|
2960
|
+
// a 5s command timeout). It is telemetry/accounting and must not hold a
|
|
2961
|
+
// completed provider response on the business request path.
|
|
2962
|
+
void this.processPricingCostEventually(Object.assign(Object.assign({}, additional_logs), { app_id, workspace_id: this.workspace_id }), event.app).then(() => this.logService.publish()).catch(() => { });
|
|
2960
2963
|
const log = Object.assign(Object.assign(Object.assign({}, this.baseLogs), additional_logs), { message: 'Process http request - success', successful_execution: true, data: { response: results }, status: types_1.LogEventStatus.SUCCESS, app_id, action: event.event, start,
|
|
2961
2964
|
end });
|
|
2962
|
-
if (pricing) {
|
|
2963
|
-
const { pricing_tag, pricing_cost, is_overage, currency } = pricing;
|
|
2964
|
-
Object.assign(log, { pricing_tag, pricing_cost, is_overage, currency });
|
|
2965
|
-
}
|
|
2966
2965
|
this.logService.add(log);
|
|
2967
2966
|
await this.addToSuccessOutput(event, results, additional_logs);
|
|
2968
2967
|
if (returnValue) {
|
|
@@ -3069,6 +3068,16 @@ class ProcessorService {
|
|
|
3069
3068
|
return null;
|
|
3070
3069
|
}
|
|
3071
3070
|
}
|
|
3071
|
+
async processPricingCostEventually(additional_logs, accessTag) {
|
|
3072
|
+
try {
|
|
3073
|
+
this.pricingService.fetchPricing();
|
|
3074
|
+
this.pricingService.fetchOveragePricing();
|
|
3075
|
+
}
|
|
3076
|
+
catch (_a) {
|
|
3077
|
+
await this.initializePricing(additional_logs, accessTag);
|
|
3078
|
+
}
|
|
3079
|
+
return this.processPricingCost(additional_logs);
|
|
3080
|
+
}
|
|
3072
3081
|
async addToSuccessOutput(event, output, additional_logs) {
|
|
3073
3082
|
// Remove event from failed, skipped, and waiting arrays
|
|
3074
3083
|
this.processingOutput.failure = this.processingOutput.failure.filter((data) => !(data.event.sequence_tag === event.sequence_tag && data.event.event === event.event));
|