-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support default workspace for queries (#78)
- Loading branch information
1 parent
da1d4a0
commit 0080e24
Showing
4 changed files
with
149 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package com.rockset.client.util; | ||
|
||
import com.rockset.client.ApiException; | ||
import org.awaitility.Awaitility; | ||
import org.hamcrest.Matchers; | ||
|
||
import java.util.concurrent.Callable; | ||
import java.util.concurrent.TimeUnit; | ||
|
||
public class RetryHelper { | ||
public static <T> T retryOnApiException(Callable<T> request) { | ||
return Awaitility | ||
.await() | ||
.atMost(5, TimeUnit.MINUTES) | ||
.pollInterval(1, TimeUnit.SECONDS) | ||
.until(() -> { | ||
try { | ||
return request.call(); | ||
} catch (ApiException e) { | ||
System.out.println("Encountered error, retrying request: " + e.getMessage()); | ||
return null; | ||
} | ||
}, Matchers.notNullValue()); | ||
} | ||
} |
Oops, something went wrong.