Skip to content
Snippets Groups Projects

Memento metri

Files

@@ -14,6 +14,7 @@ import nl.tudelft.ewi.auta.common.model.entity.ProjectEntity;
import nl.tudelft.ewi.auta.common.communication.ServerCommunicationException;
import nl.tudelft.ewi.auta.common.threads.Threads;
import nl.tudelft.ewi.auta.core.database.EntityContainer;
import nl.tudelft.ewi.auta.core.settings.GlobalSettings;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@@ -74,22 +75,31 @@ public class MessageReceiver {
@Nullable
private transient KeyPair keyPair;
/**
* The server settings.
*/
private GlobalSettings settings;
/**
* Initializes a ReportReceiver for receiving worker reports.
* @param pool the current worker pool
* @param jump a jump instance
* @param resultsProcessor the results processor to pass finished jobs to
* @param threads the Thread wrapper
* @param settings the server settings
*/
@Autowired
public MessageReceiver(final WorkerPool pool,
final Jump jump,
final ResultsProcessor resultsProcessor,
final Threads threads) {
final Threads threads,
final GlobalSettings settings) {
this.pool = pool;
this.jump = jump;
this.resultsProcessor = resultsProcessor;
this.threads = threads;
this.metrics.addAll((List<Map>) settings.get("worker metrics"));
this.settings = settings;
}
/**
@@ -254,6 +264,7 @@ public class MessageReceiver {
final var workerMetrics = (List<Map>) data.get("metrics");
this.metrics.clear();
this.metrics.addAll(workerMetrics);
this.settings.put("worker metrics", workerMetrics);
worker.setLastPing(Instant.now());
worker.setLoad(((Number) data.get("load")).doubleValue());
Loading