Skip to content

Commit

Permalink
HPCC-30252 Optimize WuInfo::IncludeServiceNames
Browse files Browse the repository at this point in the history
Use new summary information from workinut if present.

Signed-off-by: Richard Chapman <[email protected]>
  • Loading branch information
richardkchapman committed Jun 26, 2024
1 parent 342ff2b commit ccc0c2f
Showing 1 changed file with 22 additions and 12 deletions.
34 changes: 22 additions & 12 deletions esp/services/ws_workunits/ws_workunitsHelpers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1203,20 +1203,30 @@ void WsWuInfo::getServiceNames(IEspECLWorkunit &info, unsigned long flags)
{
if (!(flags & WUINFO_IncludeServiceNames))
return;

StringArray serviceNames;
WuScopeFilter filter;
filter.addScopeType("activity");
filter.addOutputAttribute(WaServiceName);
filter.addRequiredAttr(WaServiceName);
filter.finishedFilter();
Owned<IConstWUScopeIterator> it = &cw->getScopeIterator(filter);
ForEach(*it)
SummaryMap services;
if (cw->getSummary(SummaryType::Service, services))
{
for (const auto& [serviceName, isOpt] : services)
if (!serviceName.empty())
serviceNames.append(serviceName.c_str());
}
else
{
StringBuffer serviceName;
const char *value = it->queryAttribute(WaServiceName, serviceName);
if (!isEmptyString(value))
serviceNames.append(value);
// Old method used if new information not present
WuScopeFilter filter;
filter.addScopeType("activity");
filter.addOutputAttribute(WaServiceName);
filter.addRequiredAttr(WaServiceName);
filter.finishedFilter();
Owned<IConstWUScopeIterator> it = &cw->getScopeIterator(filter);
ForEach(*it)
{
StringBuffer serviceName;
const char *value = it->queryAttribute(WaServiceName, serviceName);
if (!isEmptyString(value))
serviceNames.append(value);
}
}
info.setServiceNames(serviceNames);
}
Expand Down

0 comments on commit ccc0c2f

Please sign in to comment.