Skip to content

Commit 2aa5e42

Browse files
author
sai-praveen-os
committed
feat(connectivity_check): run endpoint checks in parallel for faster execution
PLATEXP-11106 Changes: - Modified handler to use Promise.all() for parallel execution - All 6 endpoints now checked simultaneously instead of sequentially - Reduces total execution time from ~30s to ~5s - Eliminates timeout cascade where slow endpoints affect subsequent checks - Improves reliability by preventing sequential timeout failures Benefits: - Faster detection of connectivity issues - More accurate results (no timeout cascades) - Lower Lambda execution costs - Better user experience in dashboard
1 parent 743e964 commit 2aa5e42

1 file changed

Lines changed: 9 additions & 7 deletions

File tree

  • modules/connectivity_check/lambda

modules/connectivity_check/lambda/index.ts

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,8 @@ export const handler = async (event: LambdaEvent): Promise<TestResult[]> => {
5151
'Testing connectivity for targets'
5252
);
5353

54-
const results: TestResult[] = [];
55-
56-
for (const target of event.targets) {
54+
// Run all connectivity checks in parallel for faster execution
55+
const checkPromises = event.targets.map(async (target) => {
5756
let result: TestResult;
5857

5958
if (target.protocol === 'tcp') {
@@ -71,11 +70,14 @@ export const handler = async (event: LambdaEvent): Promise<TestResult[]> => {
7170
};
7271
}
7372

74-
results.push(result);
73+
return result;
74+
});
7575

76-
// Publish metrics to Datadog
77-
publishMetrics(result);
78-
}
76+
// Wait for all checks to complete
77+
const results = await Promise.all(checkPromises);
78+
79+
// Publish metrics to Datadog for all results
80+
results.forEach(result => publishMetrics(result));
7981

8082
log.info({ successCount: results.filter(r => r.success).length, totalCount: results.length }, 'Connectivity check complete');
8183

0 commit comments

Comments
 (0)