apache / apache/servicecomb-java-chassis
如何在指定时间内强制接口返回消息
Open
- Dominant language
- Java
- Stars
- 1.9k
- Forks
- 814
- Avg merge
- 8d 23h
- Merged PRs (30d)
- 1
Description
作为服务端,为了避免影响用户体验,接口要求必须在N ms内返回。
如果不在客户端控制,如何在服务端实现这个能力?
一种方法是,进入工作线程后,定义一个Timer,设置超时时间,开启另个线程执行工作任务,当超时后,主线程cancel掉工作任务,并返回客户端。
还有没有其他的简易实现办法?
Contributor guide
No contributing guide indexed for this repository
Research direction
The issue names no files, tests, or entry points and asks for a server-side timeout design rather than a specific change. Start by locating ServiceComb's server request-handling and task-execution code, then establish how a timeout should stop or isolate work and what response clients receive when N ms is exceeded; done requires an agreed implementation scope and tests for the timeout behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- api, backend
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 20/100