윤영준 윤영준 05-24
rewriting of event handling class, StreamSources 1. counting error fixed (ok_counts and failure_counts)
1. counting error fixed (ok_counts and failure_counts)
@9756b57aa61d77ea32c33aff3b8f056e616b122f
postprocess_draft.py
--- postprocess_draft.py
+++ postprocess_draft.py
@@ -101,8 +101,9 @@
         if self.sources[source]["force_send_mode"]:
             seek_n_recent_memory = min(len(self.sources[source]["status_counts"]), self.failure_mode_check_past_n)
             print(seek_n_recent_memory)
+            print(self.sources[source]["status_counts"][:-seek_n_recent_memory])
             self.sources[source]['ok_counts'] = (seek_n_recent_memory
-                              - sum(self.sources[source]["status_counts"][:-seek_n_recent_memory-1]))
+                              - sum(self.sources[source]["status_counts"][-seek_n_recent_memory:]))
             self.sources[source]['failure_counts'] = seek_n_recent_memory - self.sources[source]['ok_counts']
             flag_send_event = True
 
@@ -116,8 +117,10 @@
         else:
             seek_n_recent_memory = min(len(self.sources[source]["status_counts"]), self.normal_mode_check_past_n)
             print(seek_n_recent_memory)
+            # mem_len = len(self.sources[source]["status_counts"])
+            # print(self.sources[source]["status_counts"][-seek_n_recent_memory:])
             self.sources[source]['ok_counts'] = (seek_n_recent_memory
-                              - sum(self.sources[source]["status_counts"][:-seek_n_recent_memory-1]))
+                              - sum(self.sources[source]["status_counts"][-seek_n_recent_memory:]))
             self.sources[source]['failure_counts'] = seek_n_recent_memory - self.sources[source]['ok_counts']
             # print(self.sources[source]['failure_counts'])
 
Add a comment
List