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

评测结果的更新(刷新)方式 #5

Open
wongsingfo opened this issue Jul 27, 2016 · 4 comments
Open

评测结果的更新(刷新)方式 #5

wongsingfo opened this issue Jul 27, 2016 · 4 comments

Comments

@wongsingfo
Copy link

如果我没有看错的话,当选手提交后,为了达到实时更新的效果,目前uoj采取的方法是每500ms访问一次/submission/xxxxx?get=status-details(这里xxxxx表示提交的ID),直到"judged":true

我觉得在比赛的时候,会有一大堆waiting,这时候请求是非常频繁的,不妨尝试codeforces的方法,使用nginx-push-stream-module。感觉上可以减轻服务器负担。

@dramforever
Copy link

dramforever commented Jul 27, 2016

如果能直接 stream (没有 buffer)的话可以直接用 server-sent events,收到更新发几行文本就好了

https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events

支持自动掉线重连、重连的时候(我记得是)Last-Event-Id 是最后一个收到的事件的 id

兼容性可能是个问题,不过貌似不是关键功能不太要紧

@shuding
Copy link

shuding commented Jul 29, 2016

赞同 server-sent events,或者 websocket(比如 GitHub 右上角的 notification)。

兼容性的话,sse ~ 83.45%websocket ~ 90.98% 都得基本抛弃 IE 了(当然有些办法比如 link)。

@virusdefender
Copy link

其实感觉这里还好,实在不行可以先上redis对这一个api做下缓存。

@abc1763613206
Copy link

神 预 言
等社区版里修吧(

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants