Skip to content

Commit

Permalink
No repeat if no commands
Browse files Browse the repository at this point in the history
  • Loading branch information
sjanel committed May 8, 2023
1 parent 4e38fe2 commit 119d298
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions src/engine/src/coincenter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,9 @@ Coincenter::Coincenter(const CoincenterInfo &coincenterInfo, const ExchangeSecre
_queryResultPrinter(coincenterInfo.apiOutputType()) {}

int Coincenter::process(const CoincenterCommands &coincenterCommands) {
const int nbRepeats = coincenterCommands.repeats();
int nbCommandsProcessed = 0;
auto commands = coincenterCommands.commands();
const int nbRepeats = commands.empty() ? 0 : coincenterCommands.repeats();
for (int repeatPos = 0; repeatPos != nbRepeats; ++repeatPos) {
if (repeatPos != 0) {
std::this_thread::sleep_for(coincenterCommands.repeatTime());
Expand All @@ -39,7 +40,7 @@ int Coincenter::process(const CoincenterCommands &coincenterCommands) {
log::info("Processing request {}/{}", repeatPos + 1, nbRepeats);
}
}
for (const CoincenterCommand &cmd : coincenterCommands.commands()) {
for (const CoincenterCommand &cmd : commands) {
processCommand(cmd);
++nbCommandsProcessed;
}
Expand Down
2 changes: 1 addition & 1 deletion src/objects/src/coincenterinfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ CurrencyCode CoincenterInfo::standardizeCurrencyCode(std::string_view currencyCo
while (begIt != endIt && isSeparator(*begIt)) {
++begIt;
}
std::transform(begIt, endIt, std::back_inserter(formattedCurrencyCode), [](char ch) { return toupper(ch); });
std::transform(begIt, endIt, std::back_inserter(formattedCurrencyCode), toupper);
log::debug("Transformed '{}' into '{}'", currencyCode, formattedCurrencyCode);
currencyCode = formattedCurrencyCode;
break;
Expand Down

0 comments on commit 119d298

Please sign in to comment.