Changeset 528


Ignore:
Timestamp:
03/23/14 17:56:32 (11 years ago)
Author:
hendrikvanantwerpen
Message:

Should not need retries with new request module.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • Dev/trunk/src/server/util/couch.js

    r527 r528  
    4343}
    4444
    45 function couchRequest (method, url, body, opts, retries) {
     45function couchRequest (method, url, body, opts) {
    4646    body = body || {};
    47     retries = _.isNumber(retries) ? retries : 3;
    4847    var options = {
    4948        method: method,
    5049        headers: {},
    5150        body: stringifyFunctions(body),
    52         json: true,
    53         timeout: 5000
     51        json: true
    5452    };
    5553    if (opts) {
     
    5755        if (opts.headers) { _.extend(options.headers, opts.headers); }
    5856    }
    59     return request(url, options)
    60     .handle(function(status,body){
    61         if ( _.isUndefined(body) ) {
    62             if ( retries > 0) {
    63                 return couchRequest(method,url,body,opts,retries-1);
    64             } else {
    65                 return new HTTPResult(-1,new Error("No response after several retries."));
    66             }
    67         } else {
    68             return body;
    69         }
    70     });
     57    return request(url, options);
    7158}
    7259
Note: See TracChangeset for help on using the changeset viewer.