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
... | ... | @@ -101,8 +101,9 @@ |
101 | 101 |
if self.sources[source]["force_send_mode"]: |
102 | 102 |
seek_n_recent_memory = min(len(self.sources[source]["status_counts"]), self.failure_mode_check_past_n) |
103 | 103 |
print(seek_n_recent_memory) |
104 |
+ print(self.sources[source]["status_counts"][:-seek_n_recent_memory]) |
|
104 | 105 |
self.sources[source]['ok_counts'] = (seek_n_recent_memory |
105 |
- - sum(self.sources[source]["status_counts"][:-seek_n_recent_memory-1])) |
|
106 |
+ - sum(self.sources[source]["status_counts"][-seek_n_recent_memory:])) |
|
106 | 107 |
self.sources[source]['failure_counts'] = seek_n_recent_memory - self.sources[source]['ok_counts'] |
107 | 108 |
flag_send_event = True |
108 | 109 |
|
... | ... | @@ -116,8 +117,10 @@ |
116 | 117 |
else: |
117 | 118 |
seek_n_recent_memory = min(len(self.sources[source]["status_counts"]), self.normal_mode_check_past_n) |
118 | 119 |
print(seek_n_recent_memory) |
120 |
+ # mem_len = len(self.sources[source]["status_counts"]) |
|
121 |
+ # print(self.sources[source]["status_counts"][-seek_n_recent_memory:]) |
|
119 | 122 |
self.sources[source]['ok_counts'] = (seek_n_recent_memory |
120 |
- - sum(self.sources[source]["status_counts"][:-seek_n_recent_memory-1])) |
|
123 |
+ - sum(self.sources[source]["status_counts"][-seek_n_recent_memory:])) |
|
121 | 124 |
self.sources[source]['failure_counts'] = seek_n_recent_memory - self.sources[source]['ok_counts'] |
122 | 125 |
# print(self.sources[source]['failure_counts']) |
123 | 126 |
|
Add a comment
Delete comment
Once you delete this comment, you won't be able to recover it. Are you sure you want to delete this comment?