From 32d3582e422325c258e9c8cefa2140564670085f Mon Sep 17 00:00:00 2001 From: Aleksey Pivovarov Date: Wed, 3 Sep 2014 12:50:30 +0400 Subject: [PATCH] github: implement abortable connection check --- .../plugins/github/tasks/GithubRepository.java | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/plugins/github/src/org/jetbrains/plugins/github/tasks/GithubRepository.java b/plugins/github/src/org/jetbrains/plugins/github/tasks/GithubRepository.java index d92c4f43cd00..c77b7cf18ace 100644 --- a/plugins/github/src/org/jetbrains/plugins/github/tasks/GithubRepository.java +++ b/plugins/github/src/org/jetbrains/plugins/github/tasks/GithubRepository.java @@ -22,10 +22,7 @@ import org.jetbrains.plugins.github.api.GithubApiUtil; import org.jetbrains.plugins.github.api.GithubConnection; import org.jetbrains.plugins.github.api.GithubIssue; import org.jetbrains.plugins.github.api.GithubIssueComment; -import org.jetbrains.plugins.github.exceptions.GithubAuthenticationException; -import org.jetbrains.plugins.github.exceptions.GithubJsonException; -import org.jetbrains.plugins.github.exceptions.GithubRateLimitExceededException; -import org.jetbrains.plugins.github.exceptions.GithubStatusCodeException; +import org.jetbrains.plugins.github.exceptions.*; import org.jetbrains.plugins.github.util.GithubAuthData; import org.jetbrains.plugins.github.util.GithubUtil; @@ -68,14 +65,20 @@ public class GithubRepository extends BaseRepositoryImpl { @Override public CancellableConnection createCancellableConnection() { return new CancellableConnection() { + private final GithubConnection myConnection = new GithubConnection(getAuthData(), false); + @Override protected void doTest() throws Exception { - getIssues("", 10, false); + try { + GithubApiUtil.getIssuesQueried(myConnection, getRepoAuthor(), getRepoName(), "", false); + } + catch (GithubOperationCanceledException ignore) { + } } @Override public void cancel() { - // TODO + myConnection.abort(); } }; }