Search code examples
node.jssails.jsskipper

how to change skipper maxTimeToBuffer attribute


I am using skipper and skipper-azure to upload multiple files at a time, if I upload small number of files lets say 20 to 30 at a time every thing works fine but if I upload more files like 200 or 300 I start receiving the following error for some of the files i.e only for two or three files not all files.

An Upstream timed out before it was plugged into a receiver

In sails>node_modules>skipper>Standalone>Upstream>Upstream.js file there is an attribute maxTimeToBuffer and its default value is 4500 when i change this to 10000 my code works fine I tested it over a 100 times.

My questions are

  • What is the impact of this change ?
  • Is there any place where I can override this configuration instead of changing it main file i don't want this configuration to go away with every update.

Thanking you guys for any help in advance


Solution

  • I had the same problem... You have to modify the http.js file located in the config folder... you have to do something like this:

    passportInit: require('passport').initialize(),
    passportSession: require('passport').session(),
    
    bodyParser: (function _configureBodyParser(){
      var skipper = require('skipper');
      var middlewareFn = skipper({
        strict: true,
        maxTimeToBuffer: 100000,
      });
      return middlewareFn;
    })(),
    
    order: [
      'cookieParser',
      'session',
      'passportInit',
      'passportSession',
      'bodyParser',
      'compress',
      'poweredBy',
      '$custom',
      'router',
      'www',
      'favicon',
    ]
    

    }