From 66d08e8b9ab3f65e052f311690bb6962aaf79d3f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Geisendo=CC=88rfer?= Date: Wed, 20 Jul 2011 19:35:48 +0200 Subject: [PATCH] Make timeout configurable, mention in docs --- Readme.md | 5 +++++ lib/airbrake.js | 3 ++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/Readme.md b/Readme.md index a643fdc..2465148 100644 --- a/Readme.md +++ b/Readme.md @@ -52,6 +52,7 @@ This screenshot shows an airbrake error send from this module: * Support for [long-stack-traces][] * Optional auto-handler for `uncaughtException` events * Provides notification url linking to airbrake in `notify()` callback +* Timeout airbrake requests after 30 seconds, you never know [long-stack-traces]: https://github.com/tlrobinson/long-stack-traces @@ -144,6 +145,10 @@ The version of this app. Set to a semantic version number, or leave unset. The protocol to use. +### airbrake.timeout = 30 * 1000 + +The timeout after which to give up trying to notify airbrake in ms. + ### airbrake.handleExceptions() Registers a `process.on('uncaughtException')` listener. When an uncaught diff --git a/lib/airbrake.js b/lib/airbrake.js index f2e3f03..d89a9b0 100644 --- a/lib/airbrake.js +++ b/lib/airbrake.js @@ -17,6 +17,7 @@ function Airbrake() { this.env = process.env.NODE_ENV; this.projectRoot = null; this.appVersion = null; + this.timeout = 30 * 1000; // Disabled, see comments in appendServerEnvironmentXml() // this.hostname = os.hostname(); @@ -65,7 +66,7 @@ Airbrake.prototype.notify = function(err, cb) { method: 'POST', url: this.url('/notifier_api/v2/notices'), body: body, - timeout: 30 * 1000, + timeout: this.timeout, headers: { 'Content-Length': body.length, 'Content-Type': 'text/xml',