mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-29 08:36:45 +01:00
Don't loop services when all mappings have been found
This commit is contained in:
parent
95df62e59b
commit
49f51f24f7
@ -140,12 +140,18 @@ public class UUIDPipeline {
|
|||||||
*/
|
*/
|
||||||
public CompletableFuture<Collection<UUIDMapping>> getNames(
|
public CompletableFuture<Collection<UUIDMapping>> getNames(
|
||||||
@NotNull final Collection<UUID> requests) {
|
@NotNull final Collection<UUID> requests) {
|
||||||
|
if (requests.isEmpty()) {
|
||||||
|
return CompletableFuture.completedFuture(Collections.emptyList());
|
||||||
|
}
|
||||||
final List<UUIDService> serviceList = this.getServiceListInstance();
|
final List<UUIDService> serviceList = this.getServiceListInstance();
|
||||||
return CompletableFuture.supplyAsync(() -> {
|
return CompletableFuture.supplyAsync(() -> {
|
||||||
final List<UUIDMapping> mappings = new ArrayList<>(requests.size());
|
final List<UUIDMapping> mappings = new ArrayList<>(requests.size());
|
||||||
final List<UUID> remainingRequests = new ArrayList<>(requests);
|
final List<UUID> remainingRequests = new ArrayList<>(requests);
|
||||||
|
|
||||||
for (final UUIDService service : serviceList) {
|
for (final UUIDService service : serviceList) {
|
||||||
|
if (remainingRequests.isEmpty()) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
final List<UUIDMapping> completedRequests = service.getNames(remainingRequests);
|
final List<UUIDMapping> completedRequests = service.getNames(remainingRequests);
|
||||||
for (final UUIDMapping mapping : completedRequests) {
|
for (final UUIDMapping mapping : completedRequests) {
|
||||||
remainingRequests.remove(mapping.getUuid());
|
remainingRequests.remove(mapping.getUuid());
|
||||||
@ -170,12 +176,18 @@ public class UUIDPipeline {
|
|||||||
*/
|
*/
|
||||||
public CompletableFuture<Collection<UUIDMapping>> getUUIDs(
|
public CompletableFuture<Collection<UUIDMapping>> getUUIDs(
|
||||||
@NotNull final Collection<String> requests) {
|
@NotNull final Collection<String> requests) {
|
||||||
|
if (requests.isEmpty()) {
|
||||||
|
return CompletableFuture.completedFuture(Collections.emptyList());
|
||||||
|
}
|
||||||
final List<UUIDService> serviceList = this.getServiceListInstance();
|
final List<UUIDService> serviceList = this.getServiceListInstance();
|
||||||
return CompletableFuture.supplyAsync(() -> {
|
return CompletableFuture.supplyAsync(() -> {
|
||||||
final List<UUIDMapping> mappings = new ArrayList<>(requests.size());
|
final List<UUIDMapping> mappings = new ArrayList<>(requests.size());
|
||||||
final List<String> remainingRequests = new ArrayList<>(requests);
|
final List<String> remainingRequests = new ArrayList<>(requests);
|
||||||
|
|
||||||
for (final UUIDService service : serviceList) {
|
for (final UUIDService service : serviceList) {
|
||||||
|
if (remainingRequests.isEmpty()) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
final List<UUIDMapping> completedRequests = service.getUUIDs(remainingRequests);
|
final List<UUIDMapping> completedRequests = service.getUUIDs(remainingRequests);
|
||||||
for (final UUIDMapping mapping : completedRequests) {
|
for (final UUIDMapping mapping : completedRequests) {
|
||||||
remainingRequests.remove(mapping.getUsername());
|
remainingRequests.remove(mapping.getUsername());
|
||||||
|
Loading…
Reference in New Issue
Block a user