spring-retry icon indicating copy to clipboard operation
spring-retry copied to clipboard

Default @Retryable has 1s blocking back-off despite docs saying otherwise

Open AriApar opened this issue 8 years ago • 2 comments

The docs for retryable annotation state that default behaviour is no backoff:

       /**
	 * Specify the backoff properties for retrying this operation. The default is no
	 * backoff, but it can be a good idea to pause between attempts (even at the cost of
	 * blocking a thread).
	 * @return a backoff specification
	 */
	Backoff backoff() default @Backoff();

but a default @Backoff annotation would have a backoff of 1s as mentioned in:

/**
 * Collects metadata for a {@link BackOffPolicy}. Features:
 *
 * <ul>
 * <li>With no explicit settings the default is a fixed delay of 1000ms</li>
 * ...
 */
public @interface Backoff {

	/**
	 * Synonym for {@link #delay()}.
	 *
	 * @return the delay in milliseconds (default 1000)
	 */
	long value() default 1000;

and used by https://github.com/spring-projects/spring-retry/blob/master/src/main/java/org/springframework/retry/annotation/AnnotationAwareRetryOperationsInterceptor.java#L319

AriApar avatar Nov 08 '17 23:11 AriApar

I reverted #88 because there is a failing test for me. Not sure why yet.

dsyer avatar Dec 05 '17 15:12 dsyer

Re-opened in case we actually want to change the default.

dsyer avatar Dec 05 '17 16:12 dsyer

The JavaDoc stays right now that it is not a "no backoff":

	/**
	 * Specify the backoff properties for retrying this operation. The default is a simple
	 * {@link Backoff} specification with no properties - see its documentation for
	 * defaults.
	 * @return a backoff specification
	 */
	Backoff backoff() default @Backoff();

So, closing as fix somehow in the past with reflection of reality on that attribute.

artembilan avatar Sep 12 '24 16:09 artembilan