---
title: "重试策略"
author: "yangbinfx"
date: "2018-04-16T16:03:39Z"
tags: []
categories: ["移动开发"]
slug: "untitled"
draft: false
lastmod: "2018-04-16T16:03:39Z"
id: 2418735
url: "https://yangbinfx.iteye.com/blog/2418735"
---

```
<!-- 
#处理失败时的重试次数
orderTaskWorker.retryCount=100
#重试时的权重，算法为：当前时间 + (rate *　retryCount) > 更新时间时，可执行 
orderTaskWorker.rate=100
-->

and RetryCount <= #retryCount# 
and UpdateTime < dateadd(n, #rate# * RetryCount, getdate())
```

```
<!--解锁重置次数加一 -->
<update id="unlockTask" parameterClass="java.lang.Long">
		update MayiTask
		set
		IsFinished = 0, RetryCount = RetryCount + 1, UpdateTime = getdate()
		where Id = #value# and IsFinished = 100
</update>
```

```
 
```