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

refactor&fix: RateLimiterService #13997

Open
wants to merge 15 commits into
base: develop
Choose a base branch
from

Conversation

anatawa12
Copy link
Member

What

#13994 (comment)

とりあえずの対応としてはこれでいいと思ってますが、new Promiseのコールバックが長いことが原因の一端になってると思うので、Limiter.prototype.getをpromise化してそれをasyncで呼ぶ形に近い将来したいと思ったのでちょっと準備してます

を実装しました

Why

What参照

Additional info (optional)

diffとしては大きいですが、小さな作業単位にcommitを分けたので、レビューするときはコミット単位にみてもらうとおそらく見やすいと思います。

#13994を先にマージする必要があるため、マージされるまでDraftにしますが Ready for Review です

Checklist

  • Read the contribution guide
  • Test working in a local environment
  • (If needed) Add story of storybook
  • (If needed) Update CHANGELOG.md
  • (If possible) Add tests

@github-actions github-actions bot added the packages/backend Server side specific issue/PR label Jun 14, 2024
@anatawa12 anatawa12 mentioned this pull request Jun 14, 2024
5 tasks
Copy link
Contributor

github-actions bot commented Jun 14, 2024

このPRによるapi.jsonの差分

差分はこちら

Get diff files from Workflow Page

Copy link

codecov bot commented Jun 14, 2024

Codecov Report

Attention: Patch coverage is 13.33333% with 52 lines in your changes missing coverage. Please review.

Project coverage is 65.29%. Comparing base (9368eb3) to head (0265d91).
Report is 4 commits behind head on develop.

Files Patch % Lines
...kages/backend/src/server/api/RateLimiterService.ts 16.32% 41 Missing ⚠️
packages/backend/src/server/api/ApiCallService.ts 0.00% 9 Missing ⚠️
...ackages/backend/src/server/api/SigninApiService.ts 0.00% 2 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop   #13997      +/-   ##
===========================================
+ Coverage    65.28%   65.29%   +0.01%     
===========================================
  Files         1004     1004              
  Lines       115245   115228      -17     
  Branches      4617     5541     +924     
===========================================
+ Hits         75233    75241       +8     
+ Misses       39985    39960      -25     
  Partials        27       27              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@u1-liquid
Copy link
Sponsor Contributor

ちょっとoutofscopeかもしれないけどrefactorついでにpolicyでrateLimitFactorを調整すると
回数だけではなく時間も影響されて実際の影響が倍になる問題を直したほうがいいかもしれません
(durationとmax両方でfactorをかけ算/割り算するのではなくmaxにだけ割り算した方が良さそう)

@KisaragiEffective
Copy link
Sponsor Member

実際の影響が倍になる

正確には2乗に比例するはずです。

@KisaragiEffective KisaragiEffective marked this pull request as ready for review June 14, 2024 23:45
@KisaragiEffective
Copy link
Sponsor Member

mark this pull request as "ready for review": #13994 is merged

@anatawa12 anatawa12 changed the title refactor: RateLimiterService refactor&fix: RateLimiterService Jun 22, 2024
@anatawa12
Copy link
Member Author

ちょっとoutofscopeかもしれないけどrefactorついでにpolicyでrateLimitFactorを調整すると 回数だけではなく時間も影響されて実際の影響が倍になる問題を直したほうがいいかもしれません (durationとmax両方でfactorをかけ算/割り算するのではなくmaxにだけ割り算した方が良さそう)

実装しました

@syuilo

This comment was marked as resolved.

@anatawa12
Copy link
Member Author

IDEのeslintがコンフィグのロードに失敗してましたすみません

@KisaragiEffective
Copy link
Sponsor Member

KisaragiEffective commented Jun 22, 2024

あ、セマンティックコミットじゃない 🙇🏻

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
packages/backend Server side specific issue/PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants