Rails 重复请求

发布于 2024-09-08 09:07:08 字数 1517 浏览 3 评论 0原文

在纠正应用程序上的一些其他错误后,我发现每个请求都会渲染一个页面两次。

Rails 正常完成请求,并在几次之后,简单地启动另一个请求。

起初以为这是 Firebug 问题或 YSlow 执行其他请求,但经过更多测试后,重复仍然存在,我放弃了这些原因。

我什至尝试在请求中逐步调试 Rails,它正常进行,完成第一个请求后,我再次在同一个调试器起始行停止,这次是第二个请求。

在日志上打印了一些行和内容以便清楚地看到,它清楚地提出了 2 个请求。

我还发现了一些我无法解释的奇怪请求

这段日志显示了第一个请求的结束,在该请求之后,有一个没有布局的奇怪索引请求,然后相同的请求再次开始处理:

    Processing ArtistImagesController#index (for 192.168.0.11 at 2010-07-08 15:10:56) [GET] 
    Parameters: {"action"=>"index", "locale"=>"pt", "controller"=>"artist_images", "artist_id"=>"2-tom-welling"}

    #^ Start of first request
    #v end of first request

    Completed in 812ms (View: 429, DB: 41) | 200 OK [http://192.168.0.20/artistas/2-tom-welling/imagens]
          SQL (0.2ms)   SET NAMES 'utf8'
          SQL (0.2ms)   SET SQL_AUTO_IS_NULL=0

    # v wierd request     
        Processing ApplicationController#index (for 192.168.0.11 at 2010-07-08 15:10:59) [GET]
        Rendering rescues/layout (not_found)
        -----------------------------------------------------> html
          SQL (0.2ms)   SET NAMES 'utf8'
          SQL (0.2ms)   SET SQL_AUTO_IS_NULL=0

    # v start of second request
        Processing ArtistImagesController#index (for 192.168.0.11 at 2010-07-08 15:11:00) [GET]
          Parameters: {"action"=>"index", "locale"=>"pt", "controller"=>"artist_images", "artist_id"=>"2-tom-welling"}

记住这一点所有这些请求都是通过仅进入页面一次而生成的:/ 在代码中搜索可能的循环或任何类型的错误,但没有发现任何错误。

请帮助非常感谢

After correcting some other bugs on the application I found out that one page is being rendered twice on every request.

Rails completes the request normally and after a few, simply starts another request.

At first thought it was a Firebug problem or YSlow doing other requests, but after more tests the duplication remained and I discarded those reasons.

I tried even debugging rails step by step in the request, it goes normally and after completing the first request, I get stopped in the same debugger start line again, this time for the second request.

Printed some lines and things to see clearly on log and it clearly makes 2 requests.

I also found a few wierd requests that I cannot explain also

This bit of log shows the end of the first request and right after that one, there is a wierd index request without layout and then the same request starts again to be processed:

    Processing ArtistImagesController#index (for 192.168.0.11 at 2010-07-08 15:10:56) [GET] 
    Parameters: {"action"=>"index", "locale"=>"pt", "controller"=>"artist_images", "artist_id"=>"2-tom-welling"}

    #^ Start of first request
    #v end of first request

    Completed in 812ms (View: 429, DB: 41) | 200 OK [http://192.168.0.20/artistas/2-tom-welling/imagens]
          SQL (0.2ms)   SET NAMES 'utf8'
          SQL (0.2ms)   SET SQL_AUTO_IS_NULL=0

    # v wierd request     
        Processing ApplicationController#index (for 192.168.0.11 at 2010-07-08 15:10:59) [GET]
        Rendering rescues/layout (not_found)
        -----------------------------------------------------> html
          SQL (0.2ms)   SET NAMES 'utf8'
          SQL (0.2ms)   SET SQL_AUTO_IS_NULL=0

    # v start of second request
        Processing ArtistImagesController#index (for 192.168.0.11 at 2010-07-08 15:11:00) [GET]
          Parameters: {"action"=>"index", "locale"=>"pt", "controller"=>"artist_images", "artist_id"=>"2-tom-welling"}

Remembering that all those requests were generated by entering the page only once :/
Searched the code for possible loops or any kind of errors but haven't found any.

Please help is very appretiated

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

遗心遗梦遗幸福 2024-09-15 09:07:08

在页面源中搜索空图像 src 属性。对于此类图像,浏览器会请求站点根目录,情况似乎就是如此。

Search your page source for empty image src attributes. For such images the browser requests the site root, which seems to be the case.

蛮可爱 2024-09-15 09:07:08

我认为您的页面提交了两次。我可以查看你的页面吗?

I think your page is submitting two times. can i view your page.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文