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 ratingsYour rating
Log in to rate
Comments
0Log in to comment
Related Prompts
MQL5 Flexible Trade Management Pro
Design a powerful MQL5 code for flexible trade management on the chart, capturing profits and eliminating losing trades with precise calculations to protect the account.
Surprise Point-and-Click Game Generator
Ask the model to design or implement a point-and-click game based on AI choices and make the result surprising.
Building an AI to Beat Pro Players in Yu-Gi-Oh
Building an AI that learns a specific deck in Yu-Gi-Oh Master Duel and beats pro players using ygo agent and Kaggle Notebooks.
Build ESP32 UI Library
Design and implement an efficient UI library for the ESP32 microcontroller, including graphics rendering and user interaction.