[swss.sh] optimize macsec feature state query (#12946)

- Why I did it
There's a slowdown in bootup related to the execution of a show command during startup of swss service. show is a pretty heavy command and takes long time to execute ~2 sec.

- How I did it
I replaced show with sonic-db-cli which takes a ms to run.

- How to verify it
Boot the switch and verify swss is active.

Signed-off-by: Stepan Blyschak <stepanb@nvidia.com>
This commit is contained in:
Stepan Blyshchak 2022-12-06 11:23:46 +02:00 committed by mssonicbld
parent 776cb55d96
commit 699800bdf1

View File

@ -304,7 +304,7 @@ function check_peer_gbsyncd()
function check_macsec() function check_macsec()
{ {
MACSEC_STATE=`show feature status | grep macsec | awk '{print $2}'` MACSEC_STATE=`$SONIC_DB_CLI CONFIG_DB hget 'FEATURE|macsec' state`
if [[ ${MACSEC_STATE} == 'enabled' ]]; then if [[ ${MACSEC_STATE} == 'enabled' ]]; then
if [ "$DEV" ]; then if [ "$DEV" ]; then