Skip to content

Commit

Permalink
fix: games reappearing that recently uploaded after restarting the cl…
Browse files Browse the repository at this point in the history
…ient

fix: timeout bug
fix: schedule
  • Loading branch information
Danny ter Haar committed May 7, 2017
1 parent 40eed6d commit da7aca4
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ private boolean doUpload(InputStream stream, Game game) {

stream.close();

Unirest.setTimeouts(10000, 15000);
Unirest.setTimeouts(10000, 80000);
String result = Unirest.post(requestUrl)
.queryString("authKey", JGMRConfig.getInstance().getAuthCode())
.queryString("turnId", game.getCurrentTurn().getTurnId())
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/nl/hyranasoftware/javagmr/domain/Game.java
Original file line number Diff line number Diff line change
Expand Up @@ -116,9 +116,9 @@ public boolean equals(Object obj) {
@Override
public int compareTo(Game o) {
if(this.getCurrentTurn().started.isAfter(o.getCurrentTurn().started)){
return -1;
return 1;
}
return 1;
return -1;
}


Expand Down
6 changes: 2 additions & 4 deletions src/main/java/nl/hyranasoftware/javagmr/util/JGMRConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ public boolean didSaveFileChange(SaveFile saveFile) {
if (saveFile.getSize() > 100 && !saveFiles.isEmpty() && saveFiles.indexOf(saveFile) != -1) {
SaveFile retrievedFile = saveFiles.get(saveFiles.indexOf(saveFile));
if (retrievedFile != null) {
if (saveFile.getSize() > (retrievedFile.getSize() + 30) || saveFile.getSize() > 0 && saveFile.getSize() != 0 || saveFile.getSize() < (retrievedFile.getSize() - 30)) {
if (saveFile.getSize() > (retrievedFile.getSize() + 30) || saveFile.getSize() > 0 && saveFile.getSize() != 0 || saveFile.getSize() < (retrievedFile.getSize() - 30)) {
if (!retrievedFile.getLastTimeModified().equals(saveFile.getLastTimeModified())) {
return true;
}
Expand All @@ -169,11 +169,10 @@ public boolean didSaveFileChange(SaveFile saveFile) {

return false;
}

public List<Game> getUploadedGames() {
return uploadedGames;
}

@JsonIgnore
public void addUploadedGame(Game game) {
game.setUploaded(DateTime.now());
this.uploadedGames.add(game);
Expand All @@ -184,7 +183,6 @@ public void addUploadedGame(Game game) {
public void uploadedGameExpired(Game game) {
this.uploadedGames.remove(game);
}

public void setUploadedGames(List<Game> uploadedGames) {
this.uploadedGames = uploadedGames;
}
Expand Down

0 comments on commit da7aca4

Please sign in to comment.