Skip to content

Commit 7544a71

Browse files
author
esenov
committed
Improve behavior of DataLogReader (or fix bug) while scanning the property history -- initialize all fields in DataLoggerIndex structure
git-svn-id: https://svnsrv.desy.de/desy/EuXFEL/WP76/karabo/karaboFramework/trunk@16141 a23ab9f9-1ea2-4934-960d-990259f9ea8c
1 parent fe27b39 commit 7544a71

1 file changed

Lines changed: 11 additions & 7 deletions

File tree

src/karabo/core/DataLogReader.cc

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -65,24 +65,26 @@ namespace karabo {
6565
if (params.has("to")) to = Epochstamp(params.get<string>("to"));
6666
unsigned int maxNumData = 0;
6767
if (params.has("maxNumData")) maxNumData = params.getAs<int>("maxNumData");
68+
69+
int lastFileIndex = getFileIndex(deviceId);
70+
if (lastFileIndex < 0) {
71+
KARABO_LOG_WARN << "File \"" << get<string>("directory") << "/" << deviceId << ".last\" not found. No data will be sent...";
72+
reply(deviceId, property, result);
73+
return;
74+
}
6875

6976
KARABO_LOG_FRAMEWORK_DEBUG << "From (UTC): " << from.toIso8601Ext();
7077
KARABO_LOG_FRAMEWORK_DEBUG << "To (UTC): " << to.toIso8601Ext();
7178

7279
DataLoggerIndex idx = findNearestLoggerIndex(deviceId, from);
80+
KARABO_LOG_FRAMEWORK_DEBUG << "Event: \"" << idx.m_event << "\", epoch: " << idx.m_epoch.toIso8601Ext()
81+
<< ", pos: " << idx.m_position << ", fileindex: " << idx.m_fileindex;
7382
if (idx.m_fileindex == -1) {
7483
KARABO_LOG_WARN << "Requested time point \"" << params.get<string>("from") << "\" for device configuration is earlier than anything logged";
7584
reply(deviceId, property, result);
7685
return;
7786
}
7887

79-
int lastFileIndex = getFileIndex(deviceId);
80-
if (lastFileIndex < 0) {
81-
KARABO_LOG_WARN << "File \"" << get<string>("directory") << "/" << deviceId << ".last\" not found. No data will be sent...";
82-
reply(deviceId, property, result);
83-
return;
84-
}
85-
8688
KARABO_LOG_FRAMEWORK_DEBUG << "Index found: event: " << idx.m_event
8789
<< ", epochstamp: " << idx.m_epoch.toIso8601Ext()
8890
<< ", trainId: " << idx.m_train
@@ -353,6 +355,8 @@ namespace karabo {
353355
nearest.m_event = event;
354356
nearest.m_epoch = epochstamp;
355357
tail = line;
358+
stringstream ss(tail);
359+
ss >> nearest.m_train >> nearest.m_position >> nearest.m_user >> nearest.m_fileindex;
356360
}
357361
}
358362
ifs.close();

0 commit comments

Comments
 (0)