gpt4 book ai didi

node.js - ioredis-如果redis关闭,则忽略请求

转载 作者:行者123 更新时间:2023-12-03 06:44:50 25 4
gpt4 key购买 nike

我正在使用ioredis。
为了防止巨大的缓冲区可能会使我的应用程序崩溃,我想在redis关闭时忽略请求,并捕获这些请求。
有什么办法可以实现?

最佳答案

您可以使用circuit breaker design pattern

Circuit breaker is a design pattern used in modern software development. It is used to detect failures and encapsulates the logic of preventing a failure from constantly recurring, during maintenance, temporary external system failure or unexpected system difficulties.

Generally Circuit Breaker can be used to check the availability of an external service. An external service can be a database server or a web service used by the application.


马丁·福勒(Martin fowler)的 blog post有一个很好的解释,并提供了有关如何执行此操作的基本实现。

关于node.js - ioredis-如果redis关闭,则忽略请求,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62299765/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com