mirror of
https://github.com/magefree/mage.git
synced 2025-12-21 19:11:59 -08:00
refactor: removed outdated code with databases sync (cards db downloads from a server);
This commit is contained in:
parent
d6adc6d051
commit
ab515e60fe
7 changed files with 9 additions and 100 deletions
|
|
@ -44,12 +44,6 @@ public interface MageServer {
|
|||
|
||||
Object serverGetPromotionMessages(String sessionId) throws MageException;
|
||||
|
||||
// sync cards send sets db
|
||||
@Deprecated // TODO: outdated, no more client/server sync, can be removed?
|
||||
List<ExpansionInfo> syncGetMissingExpansionData(List<String> codes);
|
||||
@Deprecated // TODO: outdated, no more client/server sync, can be removed?
|
||||
List<CardInfo> syncGetMissingCardsData(List<String> classNames);
|
||||
|
||||
ServerState getServerState() throws MageException; // TODO: need stable update process, so rename it after few releases
|
||||
|
||||
// TODO: miss session
|
||||
|
|
|
|||
|
|
@ -28,7 +28,6 @@ public class Connection {
|
|||
private String proxyUsername;
|
||||
private String proxyPassword;
|
||||
private int clientCardDatabaseVersion;
|
||||
private boolean forceDBComparison;
|
||||
private String userIdStr;
|
||||
private int socketWriteTimeout;
|
||||
|
||||
|
|
@ -261,15 +260,6 @@ public class Connection {
|
|||
return userData;
|
||||
}
|
||||
|
||||
@Deprecated // TODO: server side cards do not supports now, so remove outdated code (db sync with server)
|
||||
public boolean isForceDBComparison() {
|
||||
return forceDBComparison;
|
||||
}
|
||||
|
||||
public void setForceDBComparison(boolean forceDBComparison) {
|
||||
this.forceDBComparison = forceDBComparison;
|
||||
}
|
||||
|
||||
public int getSocketWriteTimeout() {
|
||||
return socketWriteTimeout;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -269,7 +269,6 @@ public class SessionImpl implements Session {
|
|||
|
||||
if (!connection.getUsername().equals("Admin")) {
|
||||
server.connectSetUserData(connection.getUsername(), sessionId, connection.getUserData(), client.getVersion().toString(), connection.getUserIdStr());
|
||||
updateDatabase(connection.isForceDBComparison(), serverState);
|
||||
}
|
||||
|
||||
logger.info("Logging: DONE");
|
||||
|
|
@ -469,29 +468,6 @@ public class SessionImpl implements Session {
|
|||
}
|
||||
}
|
||||
|
||||
private void updateDatabase(boolean forceDBComparison, ServerState serverState) {
|
||||
// download NEW cards/sets, but do not download data fixes (it's an old and rare feature from old clients, e.g. one client for different servers with different cards)
|
||||
// use case: server gets new minor version with new cards, old client can get that cards too without donwload new version
|
||||
|
||||
// sets
|
||||
long expansionDBVersion = ExpansionRepository.instance.getContentVersionFromDB();
|
||||
if (forceDBComparison || serverState.getExpansionsContentVersion() > expansionDBVersion) {
|
||||
List<String> setCodes = ExpansionRepository.instance.getSetCodes();
|
||||
List<ExpansionInfo> expansions = server.syncGetMissingExpansionData(setCodes);
|
||||
logger.info("DB: updating sets... Found new: " + expansions.size());
|
||||
ExpansionRepository.instance.saveSets(expansions, null, serverState.getExpansionsContentVersion());
|
||||
}
|
||||
|
||||
// cards
|
||||
long cardDBVersion = CardRepository.instance.getContentVersionFromDB();
|
||||
if (forceDBComparison || serverState.getCardsContentVersion() > cardDBVersion) {
|
||||
List<String> classNames = CardRepository.instance.getClassNames();
|
||||
List<CardInfo> cards = server.syncGetMissingCardsData(classNames);
|
||||
logger.info("DB: updating cards... Found new: " + cards.size());
|
||||
CardRepository.instance.saveCards(cards, serverState.getCardsContentVersion());
|
||||
}
|
||||
}
|
||||
|
||||
private void handleCannotConnectException(CannotConnectException ex) {
|
||||
logger.warn("Cannot connect", ex);
|
||||
Throwable t = ex.getCause();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue