Skip to content

Commit 2a49222

Browse files
committed
Pull in xamarin-android-tools
1 parent d04b11a commit 2a49222

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

src/Xamarin.Android.Build.Tasks/Tasks/RemoveDirFixed.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,6 @@ public class RemoveDirFixed : AndroidTask
4040
{
4141
public override string TaskPrefix => "RDF";
4242

43-
const int DEFAULT_DIRECTORY_DELETE_RETRY_DELAY_MS = 1000;
44-
const int DEFAULT_REMOVEDIRFIXED_RETRIES = 10;
4543
const int ERROR_ACCESS_DENIED = -2147024891;
4644
const int ERROR_SHARING_VIOLATION = -2147024864;
4745

@@ -56,8 +54,10 @@ public override bool RunTask ()
5654
continue;
5755
}
5856
int retryCount = 0;
57+
int attempts = Files.GetFileWriteRetryAttempts ();
58+
int delay = Files.GetFileWriteRetryDelay ();
5959
try {
60-
while (retryCount <= DEFAULT_REMOVEDIRFIXED_RETRIES) {
60+
while (retryCount <= attempts) {
6161
try {
6262
// try to do a normal "fast" delete of the directory.
6363
// only do the set writable on the second attempt
@@ -78,14 +78,14 @@ public override bool RunTask ()
7878
case UnauthorizedAccessException:
7979
case IOException:
8080
int code = Marshal.GetHRForException(e);
81-
if ((code != ERROR_ACCESS_DENIED && code != ERROR_SHARING_VIOLATION) || retryCount == DEFAULT_REMOVEDIRFIXED_RETRIES) {
81+
if ((code != ERROR_ACCESS_DENIED && code != ERROR_SHARING_VIOLATION) || retryCount >= attempts) {
8282
throw;
8383
};
8484
break;
8585
default:
8686
throw;
8787
}
88-
Thread.Sleep(DEFAULT_DIRECTORY_DELETE_RETRY_DELAY_MS);
88+
Thread.Sleep (delay);
8989
retryCount++;
9090
}
9191
}

0 commit comments

Comments
 (0)