Subversion Repositories SmartDukaan

Rev

Rev 36819 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 36819 Rev 36989
Line 70... Line 70...
70
        String idemKey = (String) request.getAttribute(REQUEST_ATTR_IDEM_KEY);
70
        String idemKey = (String) request.getAttribute(REQUEST_ATTR_IDEM_KEY);
71
        if (idemKey == null) {
71
        if (idemKey == null) {
72
            return;
72
            return;
73
        }
73
        }
74
        String redisKey = IDEM_PREFIX + idemKey;
74
        String redisKey = IDEM_PREFIX + idemKey;
75
        if (ex == null && response.getStatus() >= 200 && response.getStatus() < 300) {
75
        // On error, release the claim immediately so the caller can retry without waiting.
-
 
76
        // On success, leave the key untouched: keep its original claim-time TTL (set in
76
            redisTemplate.opsForValue().set(redisKey, "done", IDEM_TTL_SECONDS, TimeUnit.SECONDS);
77
        // preHandle) and do NOT re-set it. Re-setting refreshed the TTL on every completion,
-
 
78
        // sliding the dedupe window forward and falsely rejecting later legitimate submissions.
77
        } else {
79
        if (ex != null || response.getStatus() < 200 || response.getStatus() >= 300) {
78
            redisTemplate.delete(redisKey);
80
            redisTemplate.delete(redisKey);
79
        }
81
        }
80
    }
82
    }
81
 
83
 
82
    private boolean isMutatingMethod(String method) {
84
    private boolean isMutatingMethod(String method) {