Skip to content

Commit

Permalink
releaseb stop permacharupdates for a sec
Browse files Browse the repository at this point in the history
  • Loading branch information
Sammers21 committed Sep 21, 2023
1 parent 72adca9 commit a4242da
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ bin/
.vscode/
out/
src/io/github/sammers/.DS_Store
docker-compose.yml
11 changes: 9 additions & 2 deletions src/io/github/sammers/pla/db/DB.java
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,15 @@ private Maybe<Snapshot> find(String bracket, FindOptions fopts, JsonObject opts)

public Maybe<MongoClientBulkWriteResult> bulkUpdateChars(List<WowAPICharacter> characters) {
List<BulkOperation> operations = characters.stream()
.map(character -> BulkOperation.createUpdate(new JsonObject().put("id", character.id()), character.toJson()))
.toList();
.map(character -> {
BulkOperation op = BulkOperation.createUpdate(
new JsonObject().put("id", character.id()),
new JsonObject().put("$set", character.toJson())
);
op.setUpsert(true);
return op;
}
).toList();
return mongoClient.rxBulkWrite("profile", operations);
}

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.schedulePeriodicallyDirect(() -> charUpdater.updateCharsInfinite(region).subscribe(), 0, 24, TimeUnit.HOURS);
// VTHREAD_SCHEDULER.schedulePeriodicallyDirect(() -> charUpdater.updateCharsInfinite(region).subscribe(), 0, 24, TimeUnit.HOURS);
emitter.onComplete();
});
}));
Expand Down

0 comments on commit a4242da

Please sign in to comment.