【发布时间】:2019-08-25 16:43:44
【问题描述】:
当云函数实例终止时,如何关闭从云函数到 redis 内存存储的连接? (我相信关闭我需要调用redis.quit(),但我只是不知道什么时候,我不能在函数返回后立即关闭它们,因为函数实例可以是reused)
因为我只是让连接保持打开状态,所以现在我收到“ECONNRESET”错误。
或者,如果像 this 这样的东西是不可能的:
process.on("exit", function(){//also process is not defined in cloud functions
redisClient.quit();
});
在 redis 配置中指定超时是最好的选择吗? (在 gcp memorystore 中如何做到这一点?)
【问题讨论】:
标签: node.js redis google-cloud-platform google-cloud-functions google-cloud-memorystore