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

Hardcoded 30s timeout for AJAX requests #914

Closed
keton opened this issue Oct 9, 2017 · 1 comment
Closed

Hardcoded 30s timeout for AJAX requests #914

keton opened this issue Oct 9, 2017 · 1 comment
Milestone

Comments

@keton
Copy link

keton commented Oct 9, 2017

System Information

  • PartKeepr Version: 1.3.0
  • Reproducible on the demo system: Most likely yes if you add enough parts and projects to the database
  • JavaScript errors:
Critical Error

Details
==================================
The server returned a response which we were not able to interpret.

Request
==================================
GET https://partkeepr.hosting.com/api/grid_presets?_dc=1507551713694

Response Status Code
==================================
0

Response
==================================
undefined

Server Configuration
==================================
doctrine_orm_version: 2.5.4
doctrine_dbal_version: 2.5.2
doctrine_common_version: 2.6.0-DEV
php_version: 7.0.22-0ubuntu0.16.04.1
auto_start_session: true
maxUploadSize: 1073741824
isOctoPartAvailable: true
availableImageFormats: JPG,GIF,PNG
max_users: unlimited
authentication_provider: PartKeepr.Auth.HTTPBasicAuthenticationProvider
tip_of_the_day_uri: https://partkeepr.org/tips/%s
password_change: true
patreonStatus: [object Object]

How to reproduce

  1. Create partkeepr instance with many parts, descriptions and full octopart metadata (prices, images, datasheets, etc.). For me magical number was about 1k parts
  2. add some projects with many parts, about 100 projects should be enough
  3. try going into project reports. After 30s error message described above will appear

What's most likely going on

(correct me if I'm wrong, I don't know php/Symphony)

  1. Interesting fact - timeout always occurs after 30 seconds and originates from client side javascript code. This is clearly visible in browser developer tools (networking section)
  2. All paths requested project reports by AJAX calls render ok but it takes longer than 30s. Data seem to be valid JSON
  3. after some investigation I've discovered that ExtJS library used by partkeepr has hardcoded timeout for requests and it's equal to 30 seconds.
  4. I've hacked together a version of ext-all.js in partkeepr-1.3.0/web/js/packages/extjs6/build that has timeouts extended to 600 seconds and my partkeepr instance has started to work. For reference my current database takes about 45s to render in "Project reports" and most likely it will take longer as part list grows.

So would it be possible to configure ExtJS timeout somehow? I don't like idea of blindly patching library I don't know every time there's partkeepr update.

There is Ext.Ajax.setTimeout(timeout) function that should do just that but it has no effect when it's executed in javascript console of partkeepr interface.

@Drachenkaetzchen
Copy link
Member

I have added a patch to increase the default timeout to 300 seconds to the latest GIT version.

To properly override the timeout, you can copy and paste the following JS snippet to your JS console:

Ext.define("PartKeepr.RestOverride", {
   override: 'PartKeepr.data.HydraProxy',

   timeout: 300000,
});

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

No branches or pull requests

2 participants