Fix initial deployment issues
This commit is contained in:
parent
6cd0cb31ec
commit
23bcc1d985
@ -99,7 +99,6 @@ import net.frozenorb.apiv3.util.SpringUtils;
|
|||||||
import org.springframework.context.ApplicationContext;
|
import org.springframework.context.ApplicationContext;
|
||||||
import org.springframework.context.ApplicationContextAware;
|
import org.springframework.context.ApplicationContextAware;
|
||||||
import org.springframework.context.annotation.Bean;
|
import org.springframework.context.annotation.Bean;
|
||||||
import org.springframework.core.env.Environment;
|
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
import java.time.Instant;
|
import java.time.Instant;
|
||||||
@ -132,13 +131,13 @@ public final class APIv3 extends AbstractVerticle implements ApplicationContextA
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void start() {
|
public void start() {
|
||||||
setupHttpServer();
|
|
||||||
|
|
||||||
BannedAsn.updateCache();
|
BannedAsn.updateCache();
|
||||||
BannedCellCarrier.updateCache();
|
BannedCellCarrier.updateCache();
|
||||||
Rank.updateCache();
|
Rank.updateCache();
|
||||||
Server.updateCache();
|
Server.updateCache();
|
||||||
ServerGroup.updateCache();
|
ServerGroup.updateCache();
|
||||||
|
|
||||||
|
setupHttpServer();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -12,7 +12,7 @@ import io.vertx.core.Vertx;
|
|||||||
|
|
||||||
@SpringBootApplication
|
@SpringBootApplication
|
||||||
@EnableScheduling
|
@EnableScheduling
|
||||||
class Main {
|
public class Main {
|
||||||
|
|
||||||
@Autowired private APIv3 verticle;
|
@Autowired private APIv3 verticle;
|
||||||
@Autowired private Environment environment;
|
@Autowired private Environment environment;
|
||||||
|
@ -51,12 +51,7 @@ public final class BannedAsn {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void updateCache() {
|
public static void updateCache() {
|
||||||
bannedAsnsCollection.find().into(new LinkedList<>(), SyncUtils.vertxWrap((bannedAsns, error) -> {
|
List<BannedAsn> bannedAsns = SyncUtils.runBlocking(v -> bannedAsnsCollection.find().into(new LinkedList<>(), v));
|
||||||
if (error != null) {
|
|
||||||
error.printStackTrace();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
Map<Integer, BannedAsn> working = new HashMap<>();
|
Map<Integer, BannedAsn> working = new HashMap<>();
|
||||||
|
|
||||||
for (BannedAsn bannedAsn : bannedAsns) {
|
for (BannedAsn bannedAsn : bannedAsns) {
|
||||||
@ -65,7 +60,6 @@ public final class BannedAsn {
|
|||||||
|
|
||||||
bannedAsnIdCache = working;
|
bannedAsnIdCache = working;
|
||||||
bannedAsnCache = bannedAsns;
|
bannedAsnCache = bannedAsns;
|
||||||
}));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private BannedAsn() {} // For Jackson
|
private BannedAsn() {} // For Jackson
|
||||||
|
@ -52,12 +52,7 @@ public final class BannedCellCarrier {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void updateCache() {
|
public static void updateCache() {
|
||||||
bannedCellCarriersCollection.find().into(new LinkedList<>(), SyncUtils.vertxWrap((bannedCellCarriers, error) -> {
|
List<BannedCellCarrier> bannedCellCarriers = SyncUtils.runBlocking(v -> bannedCellCarriersCollection.find().into(new LinkedList<>(), v));
|
||||||
if (error != null) {
|
|
||||||
error.printStackTrace();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
Map<Integer, BannedCellCarrier> working = new HashMap<>();
|
Map<Integer, BannedCellCarrier> working = new HashMap<>();
|
||||||
|
|
||||||
for (BannedCellCarrier bannedCellCarrier : bannedCellCarriers) {
|
for (BannedCellCarrier bannedCellCarrier : bannedCellCarriers) {
|
||||||
@ -66,7 +61,6 @@ public final class BannedCellCarrier {
|
|||||||
|
|
||||||
bannedCellCarrierIdCache = working;
|
bannedCellCarrierIdCache = working;
|
||||||
bannedCellCarrierCache = bannedCellCarriers;
|
bannedCellCarrierCache = bannedCellCarriers;
|
||||||
}));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private BannedCellCarrier() {} // For Jackson
|
private BannedCellCarrier() {} // For Jackson
|
||||||
|
@ -57,12 +57,7 @@ public final class Rank {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void updateCache() {
|
public static void updateCache() {
|
||||||
ranksCollection.find().into(new LinkedList<>(), SyncUtils.vertxWrap((ranks, error) -> {
|
List<Rank> ranks = SyncUtils.runBlocking(v -> ranksCollection.find().into(new LinkedList<>(), v));
|
||||||
if (error != null) {
|
|
||||||
error.printStackTrace();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
Map<String, Rank> working = new HashMap<>();
|
Map<String, Rank> working = new HashMap<>();
|
||||||
|
|
||||||
for (Rank rank : ranks) {
|
for (Rank rank : ranks) {
|
||||||
@ -71,7 +66,6 @@ public final class Rank {
|
|||||||
|
|
||||||
rankIdCache = working;
|
rankIdCache = working;
|
||||||
rankCache = ranks;
|
rankCache = ranks;
|
||||||
}));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private Rank() {} // For Jackson
|
private Rank() {} // For Jackson
|
||||||
|
@ -61,12 +61,7 @@ public final class Server {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void updateCache() {
|
public static void updateCache() {
|
||||||
serversCollection.find().into(new LinkedList<>(), SyncUtils.vertxWrap((servers, error) -> {
|
List<Server> servers = SyncUtils.runBlocking(v -> serversCollection.find().into(new LinkedList<>(), v));
|
||||||
if (error != null) {
|
|
||||||
error.printStackTrace();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
Map<String, Server> working = new HashMap<>();
|
Map<String, Server> working = new HashMap<>();
|
||||||
|
|
||||||
for (Server server : servers) {
|
for (Server server : servers) {
|
||||||
@ -75,7 +70,6 @@ public final class Server {
|
|||||||
|
|
||||||
serverIdCache = working;
|
serverIdCache = working;
|
||||||
serverCache = servers;
|
serverCache = servers;
|
||||||
}));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void updateTimedOutServers() {
|
private static void updateTimedOutServers() {
|
||||||
|
@ -59,12 +59,7 @@ public final class ServerGroup {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void updateCache() {
|
public static void updateCache() {
|
||||||
serverGroupsCollection.find().into(new LinkedList<>(), SyncUtils.vertxWrap((serverGroups, error) -> {
|
List<ServerGroup> serverGroups = SyncUtils.runBlocking(v -> serverGroupsCollection.find().into(new LinkedList<>(), v));
|
||||||
if (error != null) {
|
|
||||||
error.printStackTrace();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
Map<String, ServerGroup> working = new HashMap<>();
|
Map<String, ServerGroup> working = new HashMap<>();
|
||||||
|
|
||||||
for (ServerGroup serverGroup : serverGroups) {
|
for (ServerGroup serverGroup : serverGroups) {
|
||||||
@ -73,7 +68,6 @@ public final class ServerGroup {
|
|||||||
|
|
||||||
serverGroupIdCache = working;
|
serverGroupIdCache = working;
|
||||||
serverGroupCache = serverGroups;
|
serverGroupCache = serverGroups;
|
||||||
}));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private ServerGroup() {} // For Jackson
|
private ServerGroup() {} // For Jackson
|
||||||
|
Loading…
Reference in New Issue
Block a user