diff --git a/src/io/github/sammers/pla/logic/CharUpdater.java b/src/io/github/sammers/pla/logic/CharUpdater.java index 42afb3a9..5beb4700 100644 --- a/src/io/github/sammers/pla/logic/CharUpdater.java +++ b/src/io/github/sammers/pla/logic/CharUpdater.java @@ -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 nickNames, String region) { diff --git a/src/io/github/sammers/pla/logic/Ladder.java b/src/io/github/sammers/pla/logic/Ladder.java index a64a8153..1ebef428 100644 --- a/src/io/github/sammers/pla/logic/Ladder.java +++ b/src/io/github/sammers/pla/logic/Ladder.java @@ -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(); }); }));