Skip to content

Commit

Permalink
Trying to avoid thread deadlock when testing
Browse files Browse the repository at this point in the history
  • Loading branch information
4pr0n committed Feb 6, 2015
1 parent 9967332 commit c2bb65b
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 10 deletions.
1 change: 0 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
language: java
jdk:
- oraclejdk8
- oraclejdk7
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ public boolean isStopped() {
}
protected void stopCheck() throws IOException {
if (shouldStop) {
threadPool.waitForThreads();
throw new IOException("Ripping interrupted");
}
}
Expand Down
11 changes: 5 additions & 6 deletions src/main/java/com/rarchives/ripme/ripper/rippers/VkRipper.java
Original file line number Diff line number Diff line change
Expand Up @@ -148,16 +148,15 @@ private void ripImages() throws IOException {
}
String url = photoIDsToURLs.get(photoID);
addURLToDownload(new URL(url));
if (isStopped() || isThisATest()) {
break;
}
}
logger.info("Received " + elements.size() + " elements");
if (elements.size() < 40) {
break;
}
offset += elements.size();

if (isStopped() || isThisATest()) {
if (elements.size() < 40 || isStopped() || isThisATest()) {
break;
}
offset += elements.size();
}
waitForThreads();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ public void testVkAlbum() throws IOException {
}
List<URL> contentURLs = new ArrayList<URL>();
contentURLs.add(new URL("https://vk.com/album45506334_172415053"));
//contentURLs.add(new URL("https://vk.com/album45506334_0"));
//contentURLs.add(new URL("https://vk.com/photos45506334"));
contentURLs.add(new URL("https://vk.com/album45506334_0"));
contentURLs.add(new URL("https://vk.com/photos45506334"));
for (URL url : contentURLs) {
VkRipper ripper = new VkRipper(url);
testRipper(ripper);
Expand Down

0 comments on commit c2bb65b

Please sign in to comment.