We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents efdd271 + fd7fbb2 commit a6fee4eCopy full SHA for a6fee4e
obplayer/log.py
@@ -51,9 +51,13 @@ def set_debug(self, flag):
51
self.debug = flag
52
53
def clear_recent_msgs(self):
54
- for item in self.recent_msgs:
55
- if item["time"] != time.strftime("%H", time.gmtime()):
56
- self.recent_msgs.remove(item)
+ # Calculate the current hour once
+ current_hour = time.strftime("%H", time.gmtime())
+
57
+ # Keep only the items that match the current hour
58
+ self.recent_msgs = [
59
+ item for item in self.recent_msgs if item["time"] == current_hour
60
+ ]
61
62
def format_logs(self, start_index=0):
63
output = []
0 commit comments