Easy Prompt
CodingCodeIntermediateeditor-pickpopular

API 限流 Bug 定位

让模型分析伪代码中的限流边界问题并提出测试。

Prompt Content

Copy and paste directly into your model or internal evaluation tool.

下面的伪代码用于限制每个用户每分钟最多 100 次请求:count = redis.incr(key); if count == 1 then expire(key, 60); if count > 100 reject else allow。请指出至少两个潜在问题,并给出对应测试用例。

Use Cases

代码评测工程面试

Reference Output

问题包括固定窗口突刺、expire 失败导致 key 永久存在、并发边界、时钟窗口不平滑等。

Scoring Rubric

5分:指出问题并配测试;3分:只指出问题;1分:只建议换算法但无诊断。

Try & save

Fill variables and copy, or save as a personal template.

This template has no variables and is ready to copy.

User Rating

0 ratings
-

Your rating

Log in to rate

Comments

0

Log in to comment

Related Prompts