Show recent sample when incidents diff is empty
This commit is contained in:
@@ -438,7 +438,16 @@ async def incidents_diff(msg: Message):
|
||||
|
||||
if not fresh:
|
||||
note = f"since {last_dt.astimezone().strftime('%Y-%m-%d %H:%M')}" if last_dt else "for the period"
|
||||
await msg.answer(f"📣 No new incidents {note} (window {hours}h)", reply_markup=system_logs_audit_kb)
|
||||
if rows:
|
||||
sample = rows[-50:]
|
||||
body = "\n".join(f"{dt.astimezone().strftime('%m-%d %H:%M')} {line}" for dt, line in sample)
|
||||
await msg.answer(
|
||||
f"📣 No new incidents {note} (window {hours}h).\nRecent sample:\n```\n{body}\n```",
|
||||
reply_markup=system_logs_audit_kb,
|
||||
parse_mode="Markdown",
|
||||
)
|
||||
else:
|
||||
await msg.answer(f"📣 No new incidents {note} (window {hours}h)", reply_markup=system_logs_audit_kb)
|
||||
return
|
||||
fresh.sort(key=lambda x: x[0])
|
||||
body = "\n".join(f"{dt.astimezone().strftime('%m-%d %H:%M')} {line}" for dt, line in fresh[-200:])
|
||||
|
||||
Reference in New Issue
Block a user