From 2fbeed2014e8c7a3d1882d25a70cdb5e1ba8b9bd Mon Sep 17 00:00:00 2001 From: vizmay Date: Wed, 30 Oct 2019 11:34:52 +0200 Subject: [PATCH] Add retry on delete operation in case of concurrency exception --- .../java/com/slimgears/rxrepo/query/DefaultEntitySet.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/rxrepo-core/src/main/java/com/slimgears/rxrepo/query/DefaultEntitySet.java b/rxrepo-core/src/main/java/com/slimgears/rxrepo/query/DefaultEntitySet.java index 1d0289d6..92387927 100644 --- a/rxrepo-core/src/main/java/com/slimgears/rxrepo/query/DefaultEntitySet.java +++ b/rxrepo-core/src/main/java/com/slimgears/rxrepo/query/DefaultEntitySet.java @@ -66,7 +66,12 @@ public Single execute() { return queryProvider.delete(builder .metaClass(metaClass) .predicate(predicate.get()) - .build()); + .build()) + .compose(Singles.backOffDelayRetry( + DefaultEntitySet::isConcurrencyException, + Duration.ofMillis(config.retryInitialDurationMillis()), + config.retryCount())); + } @Override