Skip to content

Commit

Permalink
Fixed bug where failing a chunk or keyframe would crash GameUpdateTask
Browse files Browse the repository at this point in the history
  • Loading branch information
Boreeas committed Oct 6, 2014
1 parent f72f8ff commit 0f4cb84
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public GameUpdateTask submit(InProgressGame game, Consumer<Exception> errorCallb

GameUpdateTask task = new GameUpdateTask(game, errorCallback);
// Run once to pull all pending chunks, then run on repeat
pool.schedule(() -> task.run(), 10, TimeUnit.MILLISECONDS);
pool.schedule(() -> task.run(), 0, TimeUnit.MILLISECONDS);
ScheduledFuture<?> self = pool.scheduleAtFixedRate(task, game.getLastChunkInfo().getNextAvailableChunk(), game.getChunkInterval(), TimeUnit.MILLISECONDS);
task.setSelf(self);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ private void pullNewKeyframes(ChunkInfo chunkInfo) {
}

private void pullNewChunks(int maxId) {
log.debug("[" + game.getGameId() + "] " + (maxId - game.getLastAvailableChunk()) + " new chunks (" + (game.getLastAvailableChunk() + 1) + " to " + maxId + ")");
//log.debug("[" + game.getGameId() + "] " + (maxId - game.getLastAvailableChunk()) + " new chunks (" + (game.getLastAvailableChunk() + 1) + " to " + maxId + ")");

// Time between chunks is occasionally less than the chunk time interval
// So we check for all missed chunks here
Expand All @@ -189,7 +189,6 @@ private void doRetriesKeyframes() {
retriesKeyframes.remove(i);
if (onKeyframePulled != null) { onKeyframeFailed.accept(i); }
}
throw new RequestException("Unreachable keyframe(s): " + retriesExceeded);
}

if (!retrySuccessful.isEmpty()) {
Expand All @@ -209,7 +208,6 @@ private void doRetriesChunk() {
retriesChunks.remove(i);
if (onChunkFailed != null) { onChunkFailed.accept(i); }
}
throw new RequestException("Unreachable chunk(s): " + retriesExceeded);
}

if (!retrySuccessful.isEmpty()) {
Expand Down

0 comments on commit 0f4cb84

Please sign in to comment.