Scale down threads for collection at power on

In case where BMC reboots and VPD-Manager re-triggers the collection
process for the FRUs, number of threads has been restricted to 2 for
now (Just a lower value).

The thread count is configurable and can be updated as required.

This is required to scale down CPU utilization at power on.

Change-Id: I7dee6dabf073bc1f17ab4f9f672aa183b00e116a
Signed-off-by: Sunny Srivastava <sunnsr25@in.ibm.com>
diff --git a/vpd-manager/src/manager.cpp b/vpd-manager/src/manager.cpp
index 51eb4af..dd00d92 100644
--- a/vpd-manager/src/manager.cpp
+++ b/vpd-manager/src/manager.cpp
@@ -29,7 +29,18 @@
     try
     {
 #ifdef IBM_SYSTEM
-        m_worker = std::make_shared<Worker>(INVENTORY_JSON_DEFAULT);
+        if (dbusUtility::isChassisPowerOn())
+        {
+            // At power on, less number of FRU(s) needs collection. we can scale
+            // down the threads to reduce CPU utilization.
+            m_worker = std::make_shared<Worker>(INVENTORY_JSON_DEFAULT,
+                                                constants::VALUE_1);
+        }
+        else
+        {
+            // Initialize with default configuration
+            m_worker = std::make_shared<Worker>(INVENTORY_JSON_DEFAULT);
+        }
 
         // Set up minimal things that is needed before bus name is claimed.
         m_worker->performInitialSetup();