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

Cover Image slows down requests #8041

Closed
sebgie opened this issue Feb 23, 2017 · 5 comments · Fixed by #8283
Closed

Cover Image slows down requests #8041

sebgie opened this issue Feb 23, 2017 · 5 comments · Fixed by #8283
Assignees
Labels
bug [triage] something behaving unexpectedly server / core Issues relating to the server or core of Ghost

Comments

@sebgie
Copy link
Contributor

sebgie commented Feb 23, 2017

Issue Summary

When an image from an external source is included as cover image for a post the image size is calculated when the post is first loaded. This works quite well under normal circumstances. If the external image is loading slowly or not at all the request is stuck while the image is loading.

Steps to Reproduce

  1. Create a new post with a cover image that is loading slowly
  2. Publish
  3. Visit the post
  4. Observe the first request being slowed down by loading the image while rendering

Short term fix would be to set the already existent timeout to an acceptable value (https://github.com/TryGhost/Ghost/blob/master/core/server/utils/image-size-from-url.js#L33).

Long term we should store the image size at the time when the image is added.

Technical details:

  • Ghost Version: master & 0.11.4
  • Node Version: LTS 4
  • Browser/OS: Chrome
  • Database: SQLite & MySQL
aileen added a commit to aileen/Ghost that referenced this issue Mar 1, 2017
refs TryGhost#8041

Calls `getImageSize` with an timeout of 6sec. and adds a default timeout (in case, function is called without optional timeout) of 10sec, to prevent node from using its default timeout of 2minutes 😱
kirrg001 pushed a commit that referenced this issue Mar 1, 2017
refs #8041

Calls `getImageSize` with an timeout of 6sec. and adds a default timeout (in case, function is called without optional timeout) of 10sec, to prevent node from using its default timeout of 2minutes 😱
@kirrg001
Copy link
Contributor

kirrg001 commented Mar 1, 2017

@AileenCGN Could you PR the fix to master as well?Thanks :)

@ErisDS
Copy link
Member

ErisDS commented Mar 20, 2017

@kirrg001 can you please copy over this change before the next release?

@ErisDS ErisDS assigned kirrg001 and unassigned aileen Mar 20, 2017
@kirrg001
Copy link
Contributor

👍

kirrg001 pushed a commit to kirrg001/Ghost that referenced this issue Mar 20, 2017
refs TryGhost#8041

Calls `getImageSize` with an timeout of 6sec. and adds a default timeout (in case, function is called without optional timeout) of 10sec, to prevent node from using its default timeout of 2minutes 😱
ErisDS pushed a commit that referenced this issue Mar 20, 2017
refs #8041

Calls `getImageSize` with an timeout of 6sec. and adds a default timeout (in case, function is called without optional timeout) of 10sec, to prevent node from using its default timeout of 2minutes 😱
@ErisDS
Copy link
Member

ErisDS commented Mar 20, 2017

This was closed by #8044 and #8189. We can revisit a longer term fix later if we need to.

@ErisDS ErisDS closed this as completed Mar 20, 2017
@ErisDS ErisDS reopened this Mar 21, 2017
@ErisDS
Copy link
Member

ErisDS commented Mar 21, 2017

This is not fixed, reopening

kirrg001 added a commit to kirrg001/Ghost that referenced this issue Mar 22, 2017
refs TryGhost#8041

- destroy socket is required, see https://nodejs.org/api/http.html#http_server_settimeout_msecs_callback
- optimise error messages in general
@kirrg001 kirrg001 added this to the 1.0.0 Beta Ready milestone Apr 3, 2017
@kirrg001 kirrg001 added server / core Issues relating to the server or core of Ghost bug [triage] something behaving unexpectedly labels Apr 3, 2017
ErisDS pushed a commit that referenced this issue Apr 4, 2017
refs #8041

* 🐛  fix image size timeout

- destroy socket is required, see https://nodejs.org/api/http.html#http_server_settimeout_msecs_callback
- optimise error messages in general

* fix jshint

* Make timeouts configureable
kirrg001 added a commit to kirrg001/Ghost that referenced this issue Apr 5, 2017
refs TryGhost#8041

- destroy socket is required, see https://nodejs.org/api/http.html#http_server_settimeout_msecs_callback
- optimise error messages in general
- make timeouts configureable
ErisDS pushed a commit that referenced this issue Apr 5, 2017
closes #8041

- destroy socket is required, see https://nodejs.org/api/http.html#http_server_settimeout_msecs_callback
- optimise error messages in general
- make timeouts configureable
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug [triage] something behaving unexpectedly server / core Issues relating to the server or core of Ghost
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants