mirror of
https://github.com/agessaman/meshcore-bot.git
synced 2026-09-16 21:02:35 +00:00
feat(db_migrations, message_handler, repeater_manager): enhance purging log functionality
- Added a new migration to include a 'details' column in the 'purging_log' table for improved logging of actions. - Refactored the `log_purging_action` method in `RepeaterManager` to handle both new and legacy schemas, ensuring compatibility with the updated database structure. - Updated `MessageHandler` to utilize the new logging method, replacing direct database updates with a unified logging approach. - Added tests to verify the presence of the new column and the correct functionality of the logging mechanism across different scenarios.
This commit is contained in:
@@ -3346,12 +3346,9 @@ class MessageHandler:
|
||||
|
||||
await self.bot.repeater_manager.check_and_auto_purge()
|
||||
|
||||
self.bot.repeater_manager.db_manager.execute_update(
|
||||
'INSERT INTO purging_log (action, details) VALUES (?, ?)',
|
||||
(
|
||||
'new_contact_discovered',
|
||||
f'New contact discovered: {contact_name} (key: {public_key[:16]}...)',
|
||||
),
|
||||
self.bot.repeater_manager.log_purging_action(
|
||||
"new_contact_discovered",
|
||||
f"New contact discovered: {contact_name} (key: {public_key[:16]}...)",
|
||||
)
|
||||
return
|
||||
|
||||
@@ -3408,9 +3405,9 @@ class MessageHandler:
|
||||
|
||||
# Log the new contact discovery
|
||||
if hasattr(self.bot, 'repeater_manager'):
|
||||
self.bot.repeater_manager.db_manager.execute_update(
|
||||
'INSERT INTO purging_log (action, details) VALUES (?, ?)',
|
||||
('new_contact_discovered', f'New contact discovered: {contact_name} (key: {public_key[:16]}...)')
|
||||
self.bot.repeater_manager.log_purging_action(
|
||||
"new_contact_discovered",
|
||||
f"New contact discovered: {contact_name} (key: {public_key[:16]}...)",
|
||||
)
|
||||
|
||||
except Exception as e:
|
||||
|
||||
Reference in New Issue
Block a user