Skip to content

Commit 80faf10

Browse files
committed
DPL: correctly handle data-processing-timeouts in sources
1 parent 5756ea1 commit 80faf10

File tree

1 file changed

+8
-12
lines changed

1 file changed

+8
-12
lines changed

Framework/Core/src/DataProcessingDevice.cxx

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -156,16 +156,19 @@ void on_data_processing_expired(uv_timer_t* handle)
156156
{
157157
auto* ref = (ServiceRegistryRef*)handle->data;
158158
auto& state = ref->get<DeviceState>();
159+
auto& spec = ref->get<DeviceSpec const>();
159160
state.loopReason |= DeviceState::TIMER_EXPIRED;
160161

161162
// Check if this is a source device
162163
O2_SIGNPOST_ID_FROM_POINTER(cid, device, handle);
163164

164-
// Source devices should never end up in this callback, since the exitTransitionTimeout should
165-
// be reset to the dataProcessingTimeout and the timers cohalesced.
166-
assert(hasOnlyGenerated(ref->get<DeviceSpec const>()) == false);
167-
O2_SIGNPOST_EVENT_EMIT_INFO(calibration, cid, "callback", "Grace period for data processing expired. Only calibrations from this point onwards.");
168-
state.allowedProcessing = DeviceState::CalibrationOnly;
165+
if (hasOnlyGenerated(spec)) {
166+
O2_SIGNPOST_EVENT_EMIT_INFO(calibration, cid, "callback", "Grace period for data processing expired. Switching to EndOfStreaming.");
167+
switchState(*ref, StreamingState::EndOfStreaming);
168+
} else {
169+
O2_SIGNPOST_EVENT_EMIT_INFO(calibration, cid, "callback", "Grace period for data processing expired. Only calibrations from this point onwards.");
170+
state.allowedProcessing = DeviceState::CalibrationOnly;
171+
}
169172
}
170173

171174
void on_communication_requested(uv_async_t* s)
@@ -1379,13 +1382,6 @@ void DataProcessingDevice::Run()
13791382
switchState(ref, StreamingState::EndOfStreaming);
13801383
}
13811384

1382-
// If this is a source device, exitTransitionTimeout and dataProcessingTimeout are effectively
1383-
// the same (because source devices are not allowed to produce any calibration).
1384-
// should be the same.
1385-
if (hasOnlyGenerated(spec) && deviceContext.dataProcessingTimeout > 0) {
1386-
deviceContext.exitTransitionTimeout = deviceContext.dataProcessingTimeout;
1387-
}
1388-
13891385
// We do not do anything in particular if the data processing timeout would go past the exitTransitionTimeout
13901386
if (deviceContext.dataProcessingTimeout > 0 && deviceContext.dataProcessingTimeout < deviceContext.exitTransitionTimeout) {
13911387
uv_update_time(state.loop);

0 commit comments

Comments
 (0)