Data Pipeline Case Studies
Retry Plan Case
A retry plan can be modeled as deterministic data before it drives real scheduling.
retry plan
Model retry timing as plain data first so tracing can inspect the resulting plan.
Retry Plan Case
retry.ts
Replay: real traced execution (multi-file project)
type RetryPlan = {
attempts: number[];
finalDelay: number;
};
function buildRetryPlan(maxRetries: number): RetryPlan {
const attempts: number[] = [];
for (let retry = 1; retry <= maxRetries; retry += 1) {
attempts.push(retry * 100);
}
const finalDelay: number = attempts.length === 0 ? 0 : attempts[attempts.length - 1];
return { attempts, finalDelay };
}
const maxRetries: number = 3;
const plan: RetryPlan = buildRetryPlan(maxRetries);
console.log(`attempts=${plan.attempts.join(",")};final=${plan.finalDelay}`);
type RetryPlan = {
attempts: number[];
finalDelay: number;
};
function buildRetryPlan(maxRetries: number): RetryPlan {
const attempts: number[] = [];
for (let retry = 1; retry <= maxRetries; retry += 1) {
attempts.push(retry * 100);
}
const finalDelay: number = attempts.length === 0 ? 0 : attempts[attempts.length - 1];
return { attempts, finalDelay };
}
const maxRetries: number = 1;
const plan: RetryPlan = buildRetryPlan(maxRetries);
console.log(`attempts=${plan.attempts.join(",")};final=${plan.finalDelay}`);
maxRetries ← 3
14 return { attempts, finalDelay };15}1617const maxRetries→ 3: number = 3; //@maxRetries=118const plan: RetryPlan = buildRetryPlan(maxRetries3);attempts ← (empty)
3 finalDelay: number;4};56function buildRetryPlan(maxRetries3: number): RetryPlan {7 const attempts→ (empty): number[] = [];attempts ← 100, retry ← 1
pass 1 of 36function buildRetryPlan(maxRetries: number): RetryPlan {7 const attempts: number[] = [];89 for (let retry1 = 1; retry <= maxRetries3; retry += 1) {10 attempts.push(retry→ 1 * 100);11 }values this step(empty) → 100attemptsAll 3 passes — pass 1 is the card above pass attemptsretry1 (empty) → 100 1 2 100 → 100,200 2 3 100,200 → 100,200,300 3 finalDelay ← 300, attempts.length ← 3
10 attempts.push(retry * 100);11 }1213 const finalDelay→ 300: number = attempts.length→ 3 === 0 ? 0 : attempts[attempts.length - 1]300;14 return { attempts, finalDelay };15}plan ← [object Object]
17const maxRetries: number = 3; //@maxRetries=118const plan→ [object Object]: RetryPlan = buildRetryPlan(maxRetries3);1920console.log(`attempts=${plan.attempts100,200,300.join(",")};final=${plan.finalDelay300}`);outputattempts=100,200,300;final=300
maxRetries ← 1
14 return { attempts, finalDelay };15}1617const maxRetries→ 1: number = 1;18const plan: RetryPlan = buildRetryPlan(maxRetries1);attempts ← (empty)
3 finalDelay: number;4};56function buildRetryPlan(maxRetries1: number): RetryPlan {7 const attempts→ (empty): number[] = [];attempts ← 100, retry ← 1
6function buildRetryPlan(maxRetries: number): RetryPlan {7 const attempts: number[] = [];89 for (let retry1 = 1; retry <= maxRetries1; retry += 1) {10 attempts.push(retry→ 1 * 100);11 }values this step(empty) → 100attemptsfinalDelay ← 100, attempts.length ← 1
10 attempts.push(retry * 100);11 }1213 const finalDelay→ 100: number = attempts.length→ 1 === 0 ? 0 : attempts[attempts.length - 1]100;14 return { attempts, finalDelay };15}plan ← [object Object]
17const maxRetries: number = 1;18const plan→ [object Object]: RetryPlan = buildRetryPlan(maxRetries1);1920console.log(`attempts=${plan.attempts100.join(",")};final=${plan.finalDelay100}`);outputattempts=100;final=100