Skip to content

Commit

Permalink
Revert "17300 Windows agent do not use timeout on fail for section Cp…
Browse files Browse the repository at this point in the history
…uLoad and DotNetClr"

This reverts commit 1f8a0a3.
  • Loading branch information
s-kipnis committed Jan 15, 2025
1 parent 1f8a0a3 commit 0a50b26
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 31 deletions.
19 changes: 0 additions & 19 deletions .werks/17300

This file was deleted.

11 changes: 5 additions & 6 deletions agents/wnx/src/engine/providers/internal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ const std::unordered_map<std::string_view, std::chrono::seconds>
&GetDelaysOnFail() {
const static std::unordered_map<std::string_view, std::chrono::seconds>
delays_on_fail = {
{kDotNetClrMemory, 0s}, //
{kWmiWebservices, cfg::G_DefaultDelayOnFail}, //
{kWmiCpuLoad, 0s}, //
{kMsExch, cfg::G_DefaultDelayOnFail}, //
{kDotNetClrMemory, cfg::G_DefaultDelayOnFail}, //
{kWmiWebservices, cfg::G_DefaultDelayOnFail}, //
{kWmiCpuLoad, cfg::G_DefaultDelayOnFail}, //
{kMsExch, cfg::G_DefaultDelayOnFail}, //
{kOhm, cfg::G_DefaultDelayOnFail},

// end of the real sections
Expand Down Expand Up @@ -129,8 +129,7 @@ void Basic::setupDelayOnFail() noexcept {
const auto &delay_in_seconds = GetDelaysOnFail().at(uniq_name_);
delay_on_fail_ = delay_in_seconds;
} catch (const std::out_of_range &) {
XLOG::l.crit("Unsupported section name {}", uniq_name_);
delay_on_fail_ = std::chrono::seconds(0);
// do nothing here
}
}

Expand Down
8 changes: 2 additions & 6 deletions agents/wnx/watest/test-section_wmi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -518,16 +518,12 @@ TEST(WmiProviderTest, BasicWmi) {
}

TEST(WmiProviderTest, DelayOnFailDefault) {
for (const auto name : {kOhm, kWmiWebservices, kMsExch}) {
for (const auto name :
{kOhm, kWmiCpuLoad, kWmiWebservices, kDotNetClrMemory, kMsExch}) {
Wmi b(name, ',');
EXPECT_EQ(b.delayOnFail(), 3600s)
<< "bad delay for section by default " << name;
}
for (const auto name : {kWmiCpuLoad, kDotNetClrMemory}) {
Wmi b(name, ',');
EXPECT_EQ(b.delayOnFail(), 0s)
<< "bad delay for section by default " << name;
}
}

TEST(WmiProviderTest, DelayOnFailShift) {
Expand Down

0 comments on commit 0a50b26

Please sign in to comment.