Mnesia:你们什么时候会限制交易重试次数?

发布于 2025-01-03 14:39:53 字数 207 浏览 4 评论 0原文

Mnesia 允许您限制重试事务的次数:

MyFun = fun() -> ... end,
{atomic, ok} = mnesia:transaction(MyFun, [], 42)

如果您不指定次数,则默认为无限

我从未见过任何真正限制重试次数的代码。你?什么情况下有用?

Mnesia lets you limit the number of times it retries a transaction:

MyFun = fun() -> ... end,
{atomic, ok} = mnesia:transaction(MyFun, [], 42)

If you don't specify a number, it defaults to infinity.

I've never seen any code that actually limits the number of retries. Have you? In what cases is it useful?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

笑脸一如从前 2025-01-10 14:39:54

当您实施软实时系统时,您可以限制重试次数,其中某些操作会受到限制在定义的持续时间内或在指定的时间发生,如果没有发生,则必须采取其他行动。

在这种情况下,您不希望其他进程在不确定事务是否成功的情况下等待。然而,mnesia 的多个事务上下文可能会改变应用程序中事务提交的方式。

然而,根据我个人的经验,具有 mnesia 的实时系统应该使用 mnesia 事件进行处理,由此,任何写入、更新、删除、插入等都会立即向所有订阅的进程/服务器生成一个瞬时事件。因此,收到此事件消息的人将采取他们希望采取的任何行动。

You may limit the number of retries when you are implementing soft real-time systems in which certain operations have to occur within a defined duration of time or at a specified time and if they don't, another action must be taken.

In such a case, you do not want other processes to wait while not being sure whether the transaction has been successful. However, several transaction contexts of mnesia may change the way transaction commits are done in your application.

However, in my personal experience, real-time systems with mnesia ought to be handled using mnesia events, whereby, any write, update, delete, insert, e.t.c generates an instantaneous Event to all subscribed Processes/Servers, there and then. So those who receive this event message would take any action they desire possible.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文