Commit ba879b8a authored by zeroleak's avatar zeroleak
Browse files

config: set mix.clients=null

/rest/mix: remove maxClients + nbIdle
parent ce41e47a
......@@ -55,8 +55,6 @@ Response:
"started":true,
"nbMixing":1,
"maxClients":10,
"nbIdle":6,
"nbQueued":17,
"threads":[{
"hash":"c7f456d5ff002faa89dadec01cc5eb98bb00fdefb92031890324ec127f9d1541",
......
......@@ -143,12 +143,10 @@ public class ApiCliConfig {
}
public void toProperties(Properties props) throws NotifiableException {
if (clients != null) {
if (clients < 1) {
throw new NotifiableException("mix.clients should be > 0");
}
props.put(KEY_MIX_CLIENTS, Integer.toString(clients));
if (clients != null && clients < 1) {
throw new NotifiableException("mix.clients should be > 0 or null");
}
props.put(KEY_MIX_CLIENTS, clients != null ? Integer.toString(clients) : "");
if (clientsPerPool != null) {
if (clientsPerPool < 1) {
throw new NotifiableException("mix.clientsPerPool should be > 0");
......
......@@ -10,8 +10,6 @@ public class ApiWalletStateResponse {
private boolean started;
private int nbMixing;
private int maxClients;
private int nbIdle;
private int nbQueued;
private Collection<ApiUtxo> threads;
......@@ -20,8 +18,6 @@ public class ApiWalletStateResponse {
MixOrchestratorState mixState = whirlpoolWalletState.getMixState();
this.nbMixing = mixState.getNbMixing();
this.maxClients = mixState.getMaxClients();
this.nbIdle = mixState.getNbIdle();
this.nbQueued = mixState.getNbQueued();
this.threads =
mixState
......@@ -39,14 +35,6 @@ public class ApiWalletStateResponse {
return nbMixing;
}
public int getMaxClients() {
return maxClients;
}
public int getNbIdle() {
return nbIdle;
}
public int getNbQueued() {
return nbQueued;
}
......
......@@ -173,7 +173,7 @@ public abstract class CliConfigFile {
}
public static class MixConfig {
@NotEmpty private int clients;
@NotEmpty private Integer clients;
@NotEmpty private int clientsPerPool;
@NotEmpty private int clientDelay;
@NotEmpty private int tx0Delay;
......@@ -193,11 +193,11 @@ public abstract class CliConfigFile {
this.mixsTarget = copy.mixsTarget;
}
public int getClients() {
public Integer getClients() {
return clients;
}
public void setClients(int clients) {
public void setClients(Integer clients) {
this.clients = clients;
}
......@@ -251,7 +251,7 @@ public abstract class CliConfigFile {
public Map<String, String> getConfigInfo() {
Map<String, String> configInfo = new HashMap<>();
configInfo.put("cli/mix/clients", Integer.toString(clients));
configInfo.put("cli/mix/clients", clients != null ? Integer.toString(clients) : "null");
configInfo.put("cli/mix/clientsPerPool", Integer.toString(clientsPerPool));
configInfo.put("cli/mix/clientDelay", Integer.toString(clientDelay));
configInfo.put("cli/mix/tx0Delay", Integer.toString(tx0Delay));
......
......@@ -82,8 +82,6 @@ public class CliStatusOrchestrator extends AbstractOrchestrator {
+ ", "
+ mixState.getNbMixing()
+ " mixing, "
+ mixState.getNbIdle()
+ " idle, "
+ mixState.getNbQueued()
+ " queued. Commands: [T]hreads, [D]eposit, [P]remix, P[O]stmix\r");
} catch (NoSessionWalletException e) {
......@@ -111,9 +109,6 @@ public class CliStatusOrchestrator extends AbstractOrchestrator {
+ whirlpoolUtxo.getUtxoConfig());
i++;
}
for (; i < cliConfig.getMix().getClients(); i++) {
log.info("⣿ Thread #" + (i + 1) + ": idle");
}
} catch (NoSessionWalletException e) {
System.out.print("⣿ Wallet CLOSED");
} catch (Exception e) {
......
......@@ -12,7 +12,7 @@ public class RunUpgradeCli {
private Logger log = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
private static final int CLI_V1 = 1;
private static final int CLI_V2 = 2;
private static final int CLI_V3 = 3;
private CliConfig cliConfig;
private CliConfigService cliConfigService;
......@@ -24,25 +24,17 @@ public class RunUpgradeCli {
public void run(int lastVersion) throws Exception {
// run upgrades
if (lastVersion < CLI_V1) {
upgradeV1();
if (lastVersion < CLI_V3) {
upgradeV3();
}
if (lastVersion < CLI_V2) {
upgradeV2();
}
}
public void upgradeV1() throws Exception {
log.info(" - Upgrading to: V1");
}
public void upgradeV2() throws Exception {
log.info(" - Upgrading to: V2");
public void upgradeV3() throws Exception {
log.info(" - Upgrading to: V3");
// set mix.clients=3
// unset mix.clients=
Properties props = cliConfigService.loadProperties();
props.put(ApiCliConfig.KEY_MIX_CLIENTS, Integer.toString(3));
props.put(ApiCliConfig.KEY_MIX_CLIENTS, "");
cliConfigService.saveProperties(props);
}
}
......@@ -31,7 +31,7 @@ import org.springframework.util.DefaultPropertiesPersister;
public class CliConfigService {
private static final Logger log = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
public static final int CLI_VERSION = 2;
public static final int CLI_VERSION = 3;
public static final String CLI_CONFIG_FILENAME = "whirlpool-cli-config.properties";
private static final String KEY_APIKEY = "cli.apiKey";
private static final String KEY_SEED = "cli.seed";
......
......@@ -20,7 +20,7 @@ cli.persistDelay = 2
cli.refreshPoolsDelay = 30
cli.proxy =
cli.mix.clients = 3
cli.mix.clients =
cli.mix.clientsPerPool = 1
cli.mix.tx0MaxOutputs = 0
cli.mix.clientDelay = 15
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment