解决web端登录时等待过久并偶尔抛出事务相关异常
问题描述 分析 登录函数中有一个事务,如下: 事务里面有一个有可能操作比较耗时的过程: 在新增登录日志的时候,获取用户的ip。 具体干了啥不重要,重要的是发了一个http请求,并且是串行的,所以这个请求比较耗时的可能是很大的,并且具备不确定性因素。 反思 TransactionRollbackException的文档注释为: This exception indicates that the transaction associated with processing of the request has been rolled back, or marked to roll back. Thus the requested operation either could not be performed or was not performed because further