@middy/do-not-wait-for-empty-event-loop 4.0.0 → 4.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +0 -53
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -36,59 +36,6 @@
|
|
|
36
36
|
<p>You can read the documentation at: <a href="https://middy.js.org/docs/middlewares/do-not-wait-for-empty-event-loop">https://middy.js.org/docs/middlewares/do-not-wait-for-empty-event-loop</a></p>
|
|
37
37
|
</div>
|
|
38
38
|
|
|
39
|
-
This middleware sets `context.callbackWaitsForEmptyEventLoop` property to `false`.
|
|
40
|
-
This will prevent Lambda from timing out because of open database connections, etc.
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
## Install
|
|
44
|
-
|
|
45
|
-
To install this middleware you can use NPM:
|
|
46
|
-
|
|
47
|
-
```bash
|
|
48
|
-
npm install --save @middy/do-not-wait-for-empty-event-loop
|
|
49
|
-
```
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
## Options
|
|
53
|
-
|
|
54
|
-
By default the middleware sets the `callbackWaitsForEmptyEventLoop` property to `false` only in the `before` phase,
|
|
55
|
-
meaning you can override it in handler to `true` if needed. You can set it in all steps with the options:
|
|
56
|
-
|
|
57
|
-
- `runOnBefore` (boolean) (default `true`) - sets property before running your handler
|
|
58
|
-
- `runOnAfter` (boolean) (default `false`)
|
|
59
|
-
- `runOnError` (boolean) (default `false`)
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
## Sample usage
|
|
63
|
-
|
|
64
|
-
```javascript
|
|
65
|
-
import middy from '@middy/core'
|
|
66
|
-
import doNotWaitForEmptyEventLoop from '@middy/do-not-wait-for-empty-event-loop'
|
|
67
|
-
|
|
68
|
-
const handler = middy((event, context) => {
|
|
69
|
-
return {}
|
|
70
|
-
})
|
|
71
|
-
|
|
72
|
-
handler.use(doNotWaitForEmptyEventLoop({runOnError: true}))
|
|
73
|
-
|
|
74
|
-
// When Lambda runs the handler it gets context with callbackWaitsForEmptyEventLoop property set to false
|
|
75
|
-
|
|
76
|
-
handler(event, context, (_, response) => {
|
|
77
|
-
t.is(context.callbackWaitsForEmptyEventLoop,false)
|
|
78
|
-
})
|
|
79
|
-
```
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
## Middy documentation and examples
|
|
83
|
-
|
|
84
|
-
For more documentation and examples, refers to the main [Middy monorepo on GitHub](https://github.com/middyjs/middy) or [Middy official website](https://middy.js.org).
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
## Contributing
|
|
88
|
-
|
|
89
|
-
Everyone is very welcome to contribute to this repository. Feel free to [raise issues](https://github.com/middyjs/middy/issues) or to [submit Pull Requests](https://github.com/middyjs/middy/pulls).
|
|
90
|
-
|
|
91
|
-
|
|
92
39
|
## License
|
|
93
40
|
|
|
94
41
|
Licensed under [MIT License](LICENSE). Copyright (c) 2017-2022 [Luciano Mammino](https://github.com/lmammino), [will Farrell](https://github.com/willfarrell), and the [Middy team](https://github.com/middyjs/middy/graphs/contributors).
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@middy/do-not-wait-for-empty-event-loop",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.1",
|
|
4
4
|
"description": "Middleware for the middy framework that allows to easily disable the wait for empty event loop in a Lambda function",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"engines": {
|
|
@@ -59,9 +59,9 @@
|
|
|
59
59
|
"url": "https://github.com/middyjs/middy/issues"
|
|
60
60
|
},
|
|
61
61
|
"homepage": "https://middy.js.org",
|
|
62
|
-
"gitHead": "
|
|
62
|
+
"gitHead": "c5ece2bfbb0d607dcdea5685bf194a6cc19acc8d",
|
|
63
63
|
"devDependencies": {
|
|
64
|
-
"@middy/core": "4.0.
|
|
64
|
+
"@middy/core": "4.0.1",
|
|
65
65
|
"@types/aws-lambda": "^8.10.76"
|
|
66
66
|
}
|
|
67
67
|
}
|