ahanikel commented on code in PR #1675:
URL: https://github.com/apache/jackrabbit-oak/pull/1675#discussion_r1735860714


##########
oak-segment-azure/src/main/java/org/apache/jackrabbit/oak/segment/azure/AzureRepositoryLock.java:
##########
@@ -137,17 +137,23 @@ private void refreshLease() {
                     writeAccessController.enableWriting();
                     lastUpdate = System.currentTimeMillis();
                 }
-            } catch (StorageException e) {
+            } catch (Exception e) {
                 timeSinceLastUpdate = (System.currentTimeMillis() - 
lastUpdate) / 1000;
 
                 if (timeSinceLastUpdate > timeToWaitBeforeWriteBlock) {
                     writeAccessController.disableWriting();
                 }
 
-                if (Set.of(StorageErrorCodeStrings.OPERATION_TIMED_OUT, 
StorageErrorCode.SERVICE_INTERNAL_ERROR, StorageErrorCodeStrings.SERVER_BUSY, 
StorageErrorCodeStrings.INTERNAL_ERROR).contains(e.getErrorCode())) {
-                    log.warn("Could not renew the lease due to the operation 
timeout or service unavailability. Retry in progress ...", e);
-                } else if (e.getHttpStatusCode() == 
Constants.HeaderConstants.HTTP_UNUSED_306) {
-                    log.warn("Client side error. Retry in progress ...", e);
+                StorageException storageException = e instanceof 
StorageException ? (StorageException) e : null;
+
+                if (storageException != null

Review Comment:
   Your solution is much better because it also keeps retrying if the 
StorageException is not of the kind that are being checked for. In the current 
state, we could also be giving up on a StorageException that falls through the 
ifs. Perfect!



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to