|
|
@@ -34,8 +34,8 @@ class RateLimitedArticleUtils:
|
|
|
filtered_records: List[Dict] = []
|
|
|
|
|
|
for gh_records in account_records.values():
|
|
|
- low_streak = 0
|
|
|
is_disabled = False
|
|
|
+ low_buffer: List[Dict] = []
|
|
|
|
|
|
for row in self._sort_records_by_date(gh_records):
|
|
|
read_rate = float(row.get("read_rate") or 0)
|
|
|
@@ -45,21 +45,23 @@ class RateLimitedArticleUtils:
|
|
|
if is_low:
|
|
|
continue
|
|
|
is_disabled = False
|
|
|
- low_streak = 0
|
|
|
filtered_records.append(row)
|
|
|
continue
|
|
|
|
|
|
if is_low:
|
|
|
- low_streak += 1
|
|
|
- if low_streak >= consist_days:
|
|
|
+ low_buffer.append(row)
|
|
|
+ if len(low_buffer) >= consist_days:
|
|
|
is_disabled = True
|
|
|
- continue
|
|
|
- filtered_records.append(row)
|
|
|
+ low_buffer.clear()
|
|
|
continue
|
|
|
|
|
|
- low_streak = 0
|
|
|
+ filtered_records.extend(low_buffer)
|
|
|
+ low_buffer.clear()
|
|
|
filtered_records.append(row)
|
|
|
|
|
|
+ if not is_disabled:
|
|
|
+ filtered_records.extend(low_buffer)
|
|
|
+
|
|
|
return filtered_records
|
|
|
|
|
|
@staticmethod
|