Changed behavior of trace deletion while being recorded
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
Dieser Commit ist enthalten in:
Ursprung
792b089e4f
Commit
e8eeeb729a
@ -132,11 +132,6 @@ public class TraceManager implements Listener {
|
||||
* @param trace the trace to be removed
|
||||
*/
|
||||
public boolean remove(Trace trace) {
|
||||
Optional<Trace> activeTrace = TraceRecorder.instance.getActiveTraceForRegion(trace.getRegion());
|
||||
if (activeTrace.isPresent() && activeTrace.get() == trace) {
|
||||
TraceRecorder.instance.stopRecording(trace.getRegion());
|
||||
}
|
||||
|
||||
Map<Integer, Trace> traces = tracesByRegion.getOrDefault(trace.getRegion(), Collections.emptyMap());
|
||||
Integer traceId = traces.entrySet().stream()
|
||||
.filter(entry -> entry.getValue() == trace)
|
||||
@ -153,7 +148,6 @@ public class TraceManager implements Listener {
|
||||
* Clears all traces
|
||||
*/
|
||||
public void clear(Region region) {
|
||||
TraceRecorder.instance.stopRecording(region);
|
||||
showDataPerRegionPerPlayer.getOrDefault(region, new HashMap<>())
|
||||
.keySet()
|
||||
.forEach(player -> {
|
||||
|
@ -104,14 +104,11 @@ public class TraceRecorder implements Listener {
|
||||
*
|
||||
* @param region region to be recorded
|
||||
*/
|
||||
public int startRecording(Region region) {
|
||||
if (activeTraces.containsKey(region)) {
|
||||
return -1;
|
||||
}
|
||||
public void startRecording(Region region) {
|
||||
if (activeTraces.containsKey(region)) return;
|
||||
|
||||
TraceRecordingWrapper wrappedTrace = new TraceRecordingWrapper(region);
|
||||
activeTraces.put(region, wrappedTrace);
|
||||
return TraceManager.instance.add(wrappedTrace.getTrace());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -89,9 +89,6 @@ public class TraceRecordingWrapper {
|
||||
protected void finalizeRecording() {
|
||||
recordsOutputStream.flush();
|
||||
recordsOutputStream.close();
|
||||
|
||||
if (trace.getRecords().isEmpty()) {
|
||||
TraceManager.instance.remove(trace);
|
||||
}
|
||||
TraceManager.instance.add(trace);
|
||||
}
|
||||
}
|
||||
|
In neuem Issue referenzieren
Einen Benutzer sperren