Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

πŸ› οΈ ν˜„μ‹€μ μΈ ν™˜κ²½ ꡬ좕을 μœ„ν•΄ λͺ¨λ“  API에 λŒ€ν•΄ delay μ„€μ • #46

Merged
merged 5 commits into from
May 10, 2024

Conversation

BangDori
Copy link
Collaborator

@BangDori BangDori commented May 10, 2024

μž‘μ—… 이유

#45 이슈 ν•΄κ²°


μž‘μ—… 사항

1️⃣ λͺ¨λ“  API에 λŒ€ν•œ delay 적용

/** 0 <= 응닡 μ‹œκ°„ <= 4초 */
const delayTime = Math.random() * 4001;

export async function createHttpSuccessResponse<T>(data: T) {
  await delay(delayTime);

  // ...
}
export async function createHttpErrorResponse(code: keyof typeof errorMessage) {
  await delay(delayTime);
  
  // ...
}

λͺ¨λ“  응닡은 μœ„ ν•¨μˆ˜λ₯Ό μ‚¬μš©ν•˜κ³  μžˆλŠ” κ²ƒμœΌλ‘œ νŒλ‹¨λ˜μ–΄, μœ„ ν•¨μˆ˜λ“€μ— λŒ€ν•΄ delayλ₯Ό μ μš©ν•˜μ˜€μŠ΅λ‹ˆλ‹€. μ•„λž˜λŠ” ν…ŒμŠ€νŠΈ 결과에 λŒ€ν•œ μ΄λ―Έμ§€μž…λ‹ˆλ‹€.


리뷰어가 μ€‘μ μ μœΌλ‘œ 확인해야 ν•˜λŠ” λΆ€λΆ„

  • λͺ¨λ“  API에 λŒ€ν•œ delayκ°€ μ •μƒμ μœΌλ‘œ 적용되고 μžˆλ‚˜μš”?

λ°œκ²¬ν•œ 이슈

1️⃣ ν…ŒμŠ€νŠΈ Timeout μ—λŸ¬

MSW에 λ“±λ‘λœ λͺ¨λ“  API에 delay μ μš©ν–ˆλ”λ‹ˆ ν…ŒμŠ€νŠΈ ν™˜κ²½μ—μ„œλ„ λ™μΌν•˜κ²Œ delayκ°€ μ μš©λ˜μ–΄, Timeout μ—λŸ¬κ°€ λ°œμƒν•˜μ˜€μŠ΅λ‹ˆλ‹€. Timeout이 λ°œμƒν•˜μ§€ μ•Šλ”λΌλ„, delay 만큼의 μ‹œκ°„μ΄ μ†Œμš”λ˜μ–΄ CI νŒŒμ΄ν”„λΌμΈμ˜ μ‹œκ°„μ„ μ†Œλͺ¨ν•  수 μžˆμ„ 것 κ°™μŠ΅λ‹ˆλ‹€.

  • ν•΄λ‹Ή 문제 해결을 μœ„ν•΄ delayλ₯Ό 주석 μ²˜λ¦¬ν•˜κ³  μ‹€μ œλ‘œ ν…ŒμŠ€νŠΈκ°€ ν•„μš”ν•œ μƒν™©μ—μ„œ 주석을 ν’€μ–΄μ„œ ν…ŒμŠ€νŠΈν•˜λŠ” λ°©λ²•μœΌλ‘œ κ²°μ •ν•˜μ˜€μŠ΅λ‹ˆλ‹€!

2️⃣ Amplify μ—λŸ¬

주석 μ²˜λ¦¬ν•˜λ©΄μ„œ, μ‚¬μš©ν•˜μ§€ μ•ŠλŠ” λ³€μˆ˜ λ•Œλ¬Έμ— Amplify μ—λŸ¬κ°€ λ°œμƒν•˜μ˜€μŠ΅λ‹ˆλ‹€.

κ·Έλž˜μ„œ MSWμ—μ„œ μ œκ³΅ν•΄μ£ΌλŠ” delay의 λ””ν΄νŠΈ νŒŒλΌλ©”ν„°λ₯Ό μ΄μš©ν•˜λŠ” λ°©μ‹μœΌλ‘œ μ„€μ •ν•˜μ˜€μŠ΅λ‹ˆλ‹€!

@BangDori BangDori requested a review from Legitgoons May 10, 2024 10:45
@BangDori BangDori self-assigned this May 10, 2024
Copy link

This pull request is automatically being deployed by Amplify Hosting (learn more).

Access this pull request here: https://pr-46.d37mn03xh3qyyz.amplifyapp.com

Copy link
Member

@Legitgoons Legitgoons left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ν™•μΈν–ˆμŠ΅λ‹ˆλ‹€. μ’€ 더 ν˜„μ‹€μ μΈ ν™˜κ²½μ—μ„œ κ°œλ°œν•  수 μžˆκ² λ„€μš”. λ³‘ν•©ν•˜μ…”λ„ μ’‹μŠ΅λ‹ˆλ‹€!

@BangDori BangDori merged commit 06b6377 into main May 10, 2024
2 checks passed
@BangDori BangDori deleted the fix/issue-45-msw-delay branch May 10, 2024 11:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants