Skip to content

Commit

Permalink
ci: add retry to redis check
Browse files Browse the repository at this point in the history
  • Loading branch information
CahidArda committed Nov 20, 2024
1 parent 35b441b commit b5c0212
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
2 changes: 1 addition & 1 deletion examples/ci/app/ci/ci.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ describe("workflow integration tests", () => {
await initiateTest(testConfig.route, testConfig.waitForSeconds)
},
{
timeout: (testConfig.waitForSeconds + 8) * 1000
timeout: (testConfig.waitForSeconds + 10) * 1000
}
)
});
Expand Down
11 changes: 10 additions & 1 deletion examples/ci/app/ci/upstash/redis.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,16 @@ export const checkRedisForResults = async (
expectedResult: string,
) => {
const key = getRedisKey("result", route, randomTestId)
const testResult = await redis.get<RedisResult>(key)
let testResult: RedisResult | null = null

for (let i=0; i<3; i++) {
testResult = await redis.get<RedisResult>(key)
if (testResult) {
break
}
await new Promise(r => setTimeout(r, 2000));
}

if (!testResult) {
throw new Error(`result not found for route ${route} with randomTestId ${randomTestId}`)
}
Expand Down

0 comments on commit b5c0212

Please sign in to comment.