- Timestamp:
- 03/23/14 17:56:32 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
Dev/trunk/src/server/util/couch.js
r527 r528 43 43 } 44 44 45 function couchRequest (method, url, body, opts , retries) {45 function couchRequest (method, url, body, opts) { 46 46 body = body || {}; 47 retries = _.isNumber(retries) ? retries : 3;48 47 var options = { 49 48 method: method, 50 49 headers: {}, 51 50 body: stringifyFunctions(body), 52 json: true, 53 timeout: 5000 51 json: true 54 52 }; 55 53 if (opts) { … … 57 55 if (opts.headers) { _.extend(options.headers, opts.headers); } 58 56 } 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); 71 58 } 72 59
Note: See TracChangeset
for help on using the changeset viewer.