Skip to content

Commit d53e9b6

Browse files
committed
config: create short unique id for tfBuilders
1 parent 3637ab4 commit d53e9b6

1 file changed

Lines changed: 8 additions & 3 deletions

File tree

src/common/discovery/Config.h

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -185,15 +185,20 @@ class Config {
185185
if (pProcType == ProcessType::StfSender) {
186186
const auto lErrorMsg = fmt::format("Parameter <{}> for StfSender must be provided on command line.",
187187
OptionKeyDiscoveryId);
188-
EDDLOG( lErrorMsg);
188+
EDDLOG(lErrorMsg);
189189
throw std::invalid_argument(lErrorMsg);
190190
}
191191
}
192192

193193
{
194194
// get an unique ID
195-
std::string lUniquePart = boost::lexical_cast<std::string>(boost::uuids::random_generator()());
196-
std::string lUniqueId = pProcType.to_string() + "-" + boost::asio::ip::host_name() + "-" + lUniquePart;
195+
const std::string lUniquePart = boost::lexical_cast<std::string>(boost::uuids::random_generator()());
196+
std::string lHostname = boost::asio::ip::host_name();
197+
lHostname = lHostname.substr(0, lHostname.find('.'));
198+
199+
std::string lUniqueId = pProcType.to_string();
200+
lUniqueId += "-" + lHostname;
201+
lUniqueId += "-" + lUniquePart.substr(0, 8);
197202

198203
IDDLOG("Parameter {} not provided, using random value={}", Config::OptionKeyDiscoveryId, lUniqueId);
199204
return lUniqueId;

0 commit comments

Comments
 (0)