Workers online working
This commit is contained in:
parent
f01a95f310
commit
daf41eb979
|
|
@ -294,13 +294,17 @@ public class InstanceInterface {
|
||||||
fundsAvailable = getFundsAvailable(exchange, "USDT", true);
|
fundsAvailable = getFundsAvailable(exchange, "USDT", true);
|
||||||
|
|
||||||
//Individual worker status needed to calculate this
|
//Individual worker status needed to calculate this
|
||||||
workers = getAllWorkersStats("binance", true);
|
workers = getAllWorkersStats(exchange, true);
|
||||||
|
|
||||||
//Funds needed
|
//Funds needed
|
||||||
fundsNeeded = 0;
|
fundsNeeded = 0;
|
||||||
|
|
||||||
//Online workers
|
//Online workers
|
||||||
onlineWorkers = 0;
|
if (workers != null) {
|
||||||
|
onlineWorkers = workers.size();
|
||||||
|
} else {
|
||||||
|
onlineWorkers = 0;
|
||||||
|
}
|
||||||
|
|
||||||
//Long workers
|
//Long workers
|
||||||
longWorkers = 0;
|
longWorkers = 0;
|
||||||
|
|
|
||||||
|
|
@ -429,12 +429,36 @@ public class HomeFragment extends Fragment {
|
||||||
});
|
});
|
||||||
|
|
||||||
CompletableFuture<InstanceInterface.ExchangeStatsData> future14 = CompletableFuture.supplyAsync(() -> {
|
CompletableFuture<InstanceInterface.ExchangeStatsData> future14 = CompletableFuture.supplyAsync(() -> {
|
||||||
try {
|
try {
|
||||||
return InstanceInterface.getExchangeStatsData("binance");
|
return InstanceInterface.getExchangeStatsData("binance");
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
System.err.print(e.toString());
|
System.err.print(e.toString());
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
CompletableFuture<InstanceInterface.ExchangeStatsData> future15 = CompletableFuture.supplyAsync(() -> {
|
||||||
|
try {
|
||||||
|
return InstanceInterface.getExchangeStatsData("gateio");
|
||||||
|
} catch (IOException e) {
|
||||||
|
System.err.print(e.toString());
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
CompletableFuture<InstanceInterface.ExchangeStatsData> future16 = CompletableFuture.supplyAsync(() -> {
|
||||||
|
try {
|
||||||
|
return InstanceInterface.getExchangeStatsData("kucoin");
|
||||||
|
} catch (IOException e) {
|
||||||
|
System.err.print(e.toString());
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
CompletableFuture<InstanceInterface.ExchangeStatsData> future17 = CompletableFuture.supplyAsync(() -> {
|
||||||
|
try {
|
||||||
|
return InstanceInterface.getExchangeStatsData("okex");
|
||||||
|
} catch (IOException e) {
|
||||||
|
System.err.print(e.toString());
|
||||||
|
return null;
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Wait for all futures to complete
|
// Wait for all futures to complete
|
||||||
|
|
@ -653,11 +677,32 @@ public class HomeFragment extends Fragment {
|
||||||
log3Content.setText(logs3);
|
log3Content.setText(logs3);
|
||||||
log4Content.setText(logs4);
|
log4Content.setText(logs4);
|
||||||
|
|
||||||
// try {
|
// Exchange stats
|
||||||
// System.err.println(future14.get());
|
InstanceInterface.ExchangeStatsData binanceGlobalStats;
|
||||||
// } catch (ExecutionException | InterruptedException e) {
|
InstanceInterface.ExchangeStatsData gateioGlobalStats;
|
||||||
// throw new RuntimeException(e);
|
InstanceInterface.ExchangeStatsData kucoinGlobalStats;
|
||||||
// }
|
InstanceInterface.ExchangeStatsData okexGlobalStats;
|
||||||
|
try {
|
||||||
|
binanceGlobalStats = future14.get();
|
||||||
|
gateioGlobalStats = future15.get();
|
||||||
|
kucoinGlobalStats = future16.get();
|
||||||
|
okexGlobalStats = future17.get();
|
||||||
|
} catch (ExecutionException | InterruptedException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (binanceGlobalStats != null) {
|
||||||
|
exchange1WorkersOnline.setText(String.valueOf(binanceGlobalStats.getOnlineWorkers()));
|
||||||
|
}
|
||||||
|
if (gateioGlobalStats != null) {
|
||||||
|
exchange2WorkersOnline.setText(String.valueOf(gateioGlobalStats.getOnlineWorkers()));
|
||||||
|
}
|
||||||
|
if (kucoinGlobalStats != null) {
|
||||||
|
exchange3WorkersOnline.setText(String.valueOf(kucoinGlobalStats.getOnlineWorkers()));
|
||||||
|
}
|
||||||
|
if (okexGlobalStats != null) {
|
||||||
|
exchange4WorkersOnline.setText(String.valueOf(okexGlobalStats.getOnlineWorkers()));
|
||||||
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue