Skip to content

Commit

Permalink
releaseb char update every 24 hrs
Browse files Browse the repository at this point in the history
  • Loading branch information
Sammers21 committed Sep 15, 2023
1 parent ef60ab2 commit 4d4bc8b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
10 changes: 3 additions & 7 deletions src/io/github/sammers/pla/logic/CharUpdater.java
Original file line number Diff line number Diff line change
Expand Up @@ -99,14 +99,10 @@ public Completable updateCharsInfinite(String region) {
.doOnComplete(() -> log.info("First portion of chars has been updated"))
.andThen(updateChars(rest, region))
.doOnSubscribe(d -> log.info("Updating second portion of chars: " + rest.size()))
.doOnComplete(() -> log.info("Second portion of chars has been updated"));
});
}).subscribeOn(Main.VTHREAD_SCHEDULER)
.andThen(Completable.defer(() -> updateCharsInfinite(region)))
.doOnError(e -> {
log.error("Update chars infinite error in region " + region, e);
updateCharsInfinite(region).subscribe();
.doOnComplete(() -> log.info("Second portion of chars has been updated"))
.onErrorComplete();
});
}).subscribeOn(Main.VTHREAD_SCHEDULER).doOnError(e -> log.error("Update chars infinite error in region " + region, e));
}

public Completable updateChars(List<String> nickNames, String region) {
Expand Down
2 changes: 1 addition & 1 deletion src/io/github/sammers/pla/logic/Ladder.java
Original file line number Diff line number Diff line change
Expand Up @@ -580,7 +580,7 @@ public Completable loadWowCharApiData(String region) {
charSearchIndex.insertNickNames(new SearchResult(character.fullName(), character.region(), character.clazz()));
});
log.info("Character data size={} for region={} has been loaded to cache in {} ms", characters.size(), region, (System.nanoTime() - tick) / 1000000);
VTHREAD_SCHEDULER.scheduleDirect(() -> charUpdater.updateCharsInfinite(region).subscribe());
VTHREAD_SCHEDULER.schedulePeriodicallyDirect(() -> charUpdater.updateCharsInfinite(region).subscribe(), 0, 24, TimeUnit.HOURS);
emitter.onComplete();
});
}));
Expand Down

0 comments on commit 4d4bc8b

Please sign in to comment.