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

backport of #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 2023-01-25 20:49:47 +02:00 committed by GitHub
parent 65e080c349
commit e33b92fcaf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -304,7 +304,7 @@ function check_peer_gbsyncd()
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 [ "$DEV" ]; then