osx 系统中浏览器多次重复请求问题

2016-03-15 15:57:14 +08:00
 fxxkgw

一个简单的 django 框架系统,前端有个按钮通过 ajax 的 get 方式到后端请求数据。
采用 nginx+uwsgi 方式部署 uwsgi_read_timeout 600;

后端的任务处理要等大概 5 分钟才能返回结果。
在 windows 下,火狐 chrome 浏览器都正常,等待 5 分钟后返回状态结果。
entry datetime = 2016-03-15 15:25:31.461384
leave datetime = 2016-03-15 15:30:34.297112
[pid: 5064|app: 0|req: 27/39] 172.25.53.11 () {46 vars in 1032 bytes} [Tue Mar 15 15:25:30 2016] GET /apionline_manual/?appid=5006&appname=&team=advance&version=&ip=172.25.53.12&work=rollback&=1458022466345 => generated 59 bytes in 303466 msecs (HTTP/1.0 200) 4 headers in 144 bytes (1 switches on core 0)

在 MacBook 中,火狐 chrome Safari 在每等待大概 2 分钟 重新发送一次请求 这个请求在 ajax 里加打印看不到 用 wireshark 能抓到 因为 uwsgi 和 nginx 之间设置的时间够长 所以说连接应该是还没有断开的,那为什么前端会重新发请求呢?
下面是有问题的, 5 分钟内请求了 3 次,在第一次返回后进入了 ajax 的 error 内。
entry api_online_direct_manual, team=advance appid=5006 appname= ip=172.25.53.11 version= work=online
entry datetime = 2016-03-15 15:47:18.261363

entry api_online_direct_manual, team=advance appid=5006 appname= ip=172.25.53.11 version= work=online
entry datetime = 2016-03-15 15:49:18.282242

entry api_online_direct_manual, team=advance appid=5006 appname= ip=172.25.53.11 version= work=online
entry datetime = 2016-03-15 15:51:18.302414

leave datetime = 2016-03-15 15:52:34.207297
[pid: 5064|app: 0|req: 31/46] 172.25.53.11 () {46 vars in 1020 bytes} [Tue Mar 15 15:47:18 2016] GET /apionline_manual/?
appid=5006&appname=&team=advance&version=&ip=172.25.53.11&work=online&
=1458028017280 => generated 59 bytes in 315951 msecs (HTTP/1.0 200) 4 headers in 144 bytes (1 switches on core 0)

leave datetime = 2016-03-15 15:54:21.686822
[pid: 5063|app: 0|req: 13/47] 172.25.53.11 () {46 vars in 1020 bytes} [Tue Mar 15 15:49:18 2016] GET /apionline_manual/?appid=5006&appname=&team=advance&version=&ip=172.25.53.11&work=online&=1458028017280 => generated 59 bytes in 303409 msecs (HTTP/1.0 200) 4 headers in 144 bytes (1 switches on core 0)

leave datetime = 2016-03-15 15:56:21.278969
[pid: 5062|app: 0|req: 4/48] 172.25.53.11 () {46 vars in 1020 bytes} [Tue Mar 15 15:51:18 2016] GET /apionline_manual/?appid=5006&appname=&team=advance&version=&ip=172.25.53.11&work=online&=1458028017280 => generated 59 bytes in 302981 msecs (HTTP/1.0 200) 4 headers in 144 bytes (1 switches on core 0)

1699 次点击
所在节点    前端开发
1 条回复
fxxkgw
2016-03-15 16:09:38 +08:00
添加一个: chrome 在返回时会报错: Failed to load resource: net::ERR_EMPTY_RESPONSE

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/263664

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX