Repository: dmwm/wmcore
Issue: Cleaned and Archived counters not zeroed in MSRuleCleaner

**Impact of the bug**
MSRuleCleaner

**Describe the bug**
Our initial idea was  to initiate the workflow counters for 'Cleaned' and 'Archived' workflows only once during the thread creation and then accumulate there while the service is running. But it does not give the correct information, because of two reasons: 
1. We are still just cleaning and not archiving the workflows with the MSRuleCleaner, that's why every each one of them sits in the queue for at least 3 days and will be fetched by the service on every run during all those days, ergo will reenter the counters multiple times.
2. We do not need the total amount of workflows treated since the initial MSRuleCleaner thread start, but we rather need only the numbers from the last pulling cycle.

**How to reproduce it**
No need to - it is a request for a change of the current behavior

**Expected behavior**
Accumulate the numbers only from the last polling cycle into the Cleanup and Archived counters. 

**Additional context and error message**
N/A

Changed files:
test/python/WMCore_t/MicroService_t/Unified_t/MSRuleCleaner_t.py, src/python/WMCore/MicroService/Unified/MSRuleCleaner.py

diff --git a/src/python/WMCore/MicroService/Unified/MSRuleCleaner.py b/src/python/WMCore/MicroService/Unified/MSRuleCleaner.py
index 03c43aa62..5fed076fd 100644
--- a/src/python/WMCore/MicroService/Unified/MSRuleCleaner.py
+++ b/src/python/WMCore/MicroService/Unified/MSRuleCleaner.py
@@ -108,8 +108,14 @@ class MSRuleCleaner(MSCore):
         # Initialization of the 'cleaned' and 'archived' counters:
         self.wfCounters = {'cleaned': {},
                            'archived': 0}
+
+    def resetCounters(self):
+        """
+        A simple function for zeroing the cleaned and archived counters.
+        """
         for pline in self.cleanuplines:
             self.wfCounters['cleaned'][pline.name] = 0
+        self.wfCounters['archived'] = 0
 
     def execute(self, reqStatus):
         """
@@ -122,6 +128,7 @@ class MSRuleCleaner(MSCore):
         self.currThread = current_thread()
         self.currThreadIdent = self.currThread.name
         self.updateReportDict(summary, "thread_id", self.currThreadIdent)
+        self.resetCounters()
 
         self.logger.info("MSRuleCleaner is running in mode: %s.", self.mode)
 
diff --git a/test/python/WMCore_t/MicroService_t/Unified_t/MSRuleCleaner_t.py b/test/python/WMCore_t/MicroService_t/Unified_t/MSRuleCleaner_t.py
index 2682339e8..a45aa8651 100644
--- a/test/python/WMCore_t/MicroService_t/Unified_t/MSRuleCleaner_t.py
+++ b/test/python/WMCore_t/MicroService_t/Unified_t/MSRuleCleaner_t.py
@@ -58,6 +58,7 @@ class MSRuleCleanerTest(unittest.TestCase):
 
         self.reqStatus = ['announced', 'aborted-completed', 'rejected']
         self.msRuleCleaner = MSRuleCleaner(self.msConfig)
+        self.msRuleCleaner.resetCounters()
         self.msRuleCleaner.rucio = Rucio.Rucio(self.msConfig['rucioAccount'],
                                                hostUrl=self.rucioConfigDict['rucio_host'],
                                                authUrl=self.rucioConfigDict['auth_host'],