Closing DAX Client in Lambda Function

六眼飞鱼酱① 提交于 2019-12-06 09:55:16

It looks like the Lambda context property callbackWaitsForEmptyEventLoop, as documented here, may be relevant to your case. By default it is set to true, which means that even if your handler returns a value via callback, as long as there is anything still in the Node event loop, the Lambda won't complete its execution.

Setting it to false will allow your Lambda handler to complete even with things in the event loop, but be aware that these logical threads will freeze execution while the Lambda is not running. This behavior might not be appropriate for all libraries, depending on how robust they are.

On an interesting side note, the old Lambda return style of calling context.succeed (rather than callback) will not wait for an empty event loop, regardless of the property's setting. (This gist goes into some extra detail.)

As of version 1.1.2 of the DAX JS client, this is no longer an issue - the Lambda event loop will pause correctly when using DAX.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!