#519·dtm

Saga模式下,分支事务超时问题

Author: 1528992118Created Aug 18, 2024Updated Jan 27, 2026

我使用的Dtm Server版本为1.18.0,下面是我注册的本次saga事务信息:

json
{
	"steps": [{
		"action": "http://localhost:9002/ccfmonitor/internal/v1/saga/test/action",
		"compensate": "http://localhost:9002/ccfmonitor/internal/v1/saga/test/compensate"
	}, {
		"action": "http://localhost:9002/ccfmonitor/internal/v1/saga/test2/action",
		"compensate": "http://localhost:9002/ccfmonitor/internal/v1/saga/test2/compensate"
	}],
	"payloads": ["{\"name\":\"dtm\"}", "{\"name\":\"dtm\"}"],
	"customData": "{\"concurrent\":true,\"orders\":{\"0\":[1]}}",
	"waitResult": false,
	"timeoutToFail": 30,
	"retryInterval": 60,
	"passthroughHeaders": [],
	"branchHeaders": {},
	"gid": "ef6cb7d2-f4e1-4905-ba26-b8c700de0427",
	"transType": "saga",
	"subType": "saga"
}

在使用过程中,主要想看下分支事务在模拟耗时情况下,DTM的处理机制,当我在ccfmonitor/internal/v1/saga/test2/action具体代码中模拟了线程睡眠10秒后,我发现Dtm Server会判定本次action接口有问题,并一直触发重试机制。这里我有个疑问,我不是将全局的超时时间设置为了30秒,为什么Dtm Server还会一直触发重试?

image