Skip to content

Commit

Permalink
Fix issue that the Lua script can not be loaded on VS
Browse files Browse the repository at this point in the history
Signed-off-by: Stephen Sun <stephens@nvidia.com>
  • Loading branch information
stephenxs committed Jan 18, 2024
1 parent d028342 commit 6155182
Showing 1 changed file with 18 additions and 10 deletions.
28 changes: 18 additions & 10 deletions orchagent/switchorch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -209,16 +209,24 @@ void SwitchOrch::initAsicSdkHealthEventNotification()

set_switch_capability(fvVector);

// Load the Lua script to eliminate oldest entries
string eliminateEventsLuaScript = swss::loadLuaScript("eliminate_events.lua");
m_eliminateEventsSha = swss::loadRedisScript(m_stateDb.get(), eliminateEventsLuaScript);

// Init timer
auto interv = timespec { .tv_sec = ASIC_SDK_HEALTH_EVENT_ELIMINATE_INTERVAL, .tv_nsec = 0 };
m_eliminateEventsTimer = new SelectableTimer(interv);
auto executor = new ExecutableTimer(m_eliminateEventsTimer, this, "ASIC_SDK_HEALTH_EVENT_ELIMINATE_TIMER");
Orch::addExecutor(executor);
m_eliminateEventsTimer->start();
try
{
// Load the Lua script to eliminate oldest entries
string eliminateEventsLuaScript = swss::loadLuaScript("eliminate_events.lua");
m_eliminateEventsSha = swss::loadRedisScript(m_stateDb.get(), eliminateEventsLuaScript);

// Init timer
auto interv = timespec { .tv_sec = ASIC_SDK_HEALTH_EVENT_ELIMINATE_INTERVAL, .tv_nsec = 0 };
m_eliminateEventsTimer = new SelectableTimer(interv);
auto executor = new ExecutableTimer(m_eliminateEventsTimer, this, "ASIC_SDK_HEALTH_EVENT_ELIMINATE_TIMER");
Orch::addExecutor(executor);
m_eliminateEventsTimer->start();
}
catch (...)
{
// This can happen only on mock test. If it happens on a real switch, we should log an error message
SWSS_LOG_ERROR("Unable to load the Lua script to eliminate events\n");
}
}

void SwitchOrch::initAclGroupsBindToSwitch()
Expand Down

0 comments on commit 6155182

Please sign in to comment.