filamentgroup / grunt-criticalcss

Grunt wrapper for criticalcss
MIT License
530 stars 27 forks source link

Option to extend timeout or handle promise rejection? #59

Closed cjholowatyj closed 1 year ago

cjholowatyj commented 4 years ago

I have grunt-criticalcss running in the background of a production environment, but one of the last hurdles I have to overcome is the issue with my environment where most pages on their first load, before they are processed by grunt, take longer than 30 seconds to load. (They load in under 2 seconds in subsequent loads after processing).

The logs I've reviewed show that the process times out after 30 seconds with the following error (I've censored out my local data):

UnhandledPromiseRejectionWarning: Error: Navigation Timeout Exceeded: 30000ms exceeded
  at /**********/node_modules/grunt-criticalcss/tasks/criticalcss.js:43:12
  at /**********/node_modules/criticalcss/critical.js:115:20

I'm just using the built-in functionality (no customization other than passing the options provided for in the documentation) using grunt.initConfig().

n my limited knowledge of the underlying programming, I see two possible solutions: (1) Handle the promise rejection; and/or (2) Create an option allowing for execution to be extended past the 30 second time limit.