Retry getting arcanist token on failure

Summary:
Many of our diffs dont have sandcastle tests because we failed to load arcanist token file (loaded over the network)
this diff try for at least 5 seconds (once every 0.2 second) to load the file instead of failing the first time the file is not found
This will make it less probable that diffs are submitted without sandcastle tests

Test Plan: arc diff --preview

Reviewers: kradhakrishnan, gunnarku, sdong

Reviewed By: sdong

Subscribers: andrewkr, dhruba

Differential Revision: https://reviews.facebook.net/D63951
This commit is contained in:
Islam AbdelRahman 2016-09-19 14:50:52 -07:00
parent b666f85445
commit 42ac9c5f1e

View File

@ -183,6 +183,14 @@ function getSandcastleConfig() {
} else {
// This is a typical `[p]arc diff` case. Fetch the values from the specific
// configuration files.
for ($i = 0; $i < 50; $i++) {
if (file_exists(PRIMARY_TOKEN_FILE) ||
file_exists(SECONDARY_TOKEN_FILE)) {
break;
}
// If we failed to fetch the tokens, sleep for 0.2 second and try again
usleep(200000);
}
assert(file_exists(PRIMARY_TOKEN_FILE) ||
file_exists(SECONDARY_TOKEN_FILE));