Skip to content

Commit c9ed2cc

Browse files
author
Tobias Christensen
committed
Merge pull request #5 from rexsuecia/master
Clear timeout after execution
2 parents 4c41e6b + ed58676 commit c9ed2cc

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

lib/invoke.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ module.exports = function (eventObj, path, handler, timeout, callback) {
3535
var context = require('./context.js');
3636

3737
var timeoutReached = false;
38-
setTimeout(function(){
38+
var timer = setTimeout(function(){
3939
timeoutReached = true;
4040
callback(new Error("Task timed out after " + (timeout / 1000).toFixed(2) + " seconds"));
4141
}, timeout);
@@ -52,4 +52,5 @@ module.exports = function (eventObj, path, handler, timeout, callback) {
5252
} else {
5353
callback(new Error('Could not find Lambda handler'));
5454
}
55+
clearTimeout(timer);
5556
};

0 commit comments

Comments
 (0)