Skip to content

Commit 49a17e7

Browse files
committed
Fix issue that the Lua script can not be loaded on VS
Signed-off-by: Stephen Sun <[email protected]>
1 parent 3daeb30 commit 49a17e7

File tree

1 file changed

+18
-10
lines changed

1 file changed

+18
-10
lines changed

orchagent/switchorch.cpp

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -209,16 +209,24 @@ void SwitchOrch::initAsicSdkHealthEventNotification()
209209

210210
set_switch_capability(fvVector);
211211

212-
// Load the Lua script to eliminate oldest entries
213-
string eliminateEventsLuaScript = swss::loadLuaScript("eliminate_events.lua");
214-
m_eliminateEventsSha = swss::loadRedisScript(m_stateDb.get(), eliminateEventsLuaScript);
215-
216-
// Init timer
217-
auto interv = timespec { .tv_sec = ASIC_SDK_HEALTH_EVENT_ELIMINATE_INTERVAL, .tv_nsec = 0 };
218-
m_eliminateEventsTimer = new SelectableTimer(interv);
219-
auto executor = new ExecutableTimer(m_eliminateEventsTimer, this, "ASIC_SDK_HEALTH_EVENT_ELIMINATE_TIMER");
220-
Orch::addExecutor(executor);
221-
m_eliminateEventsTimer->start();
212+
try
213+
{
214+
// Load the Lua script to eliminate oldest entries
215+
string eliminateEventsLuaScript = swss::loadLuaScript("eliminate_events.lua");
216+
m_eliminateEventsSha = swss::loadRedisScript(m_stateDb.get(), eliminateEventsLuaScript);
217+
218+
// Init timer
219+
auto interv = timespec { .tv_sec = ASIC_SDK_HEALTH_EVENT_ELIMINATE_INTERVAL, .tv_nsec = 0 };
220+
m_eliminateEventsTimer = new SelectableTimer(interv);
221+
auto executor = new ExecutableTimer(m_eliminateEventsTimer, this, "ASIC_SDK_HEALTH_EVENT_ELIMINATE_TIMER");
222+
Orch::addExecutor(executor);
223+
m_eliminateEventsTimer->start();
224+
}
225+
catch (...)
226+
{
227+
// This can happen only on mock test. If it happens on a real switch, we should log an error message
228+
SWSS_LOG_ERROR("Unable to load the Lua script to eliminate events\n");
229+
}
222230
}
223231

224232
void SwitchOrch::initAclGroupsBindToSwitch()

0 commit comments

Comments
 (0)