Closed mihan007 closed 5 years ago
no; you can easy make this functional manually; tables from this module can be safely excluded from backup, it as logs only
I'm going to make console command to clear deprecated logs.
Thanks. Looking forward to get it.
Done. https://github.com/zhuravljov/yii2-queue-monitor/blob/master/README.md#console
But you can use DB-specified solutions also. MySQL routines-based solution look like as:
DROP PROCEDURE IF EXISTS clear_queue_monitor_deprecated_records;
DELIMITER ;;
CREATE PROCEDURE clear_queue_monitor_deprecated_records(
IN in_min_time TIMESTAMP
)
SQL SECURITY INVOKER
MODIFIES SQL DATA
COMMENT 'Procedure to clear deprecated rows using min time param.'
BEGIN
DELETE exec.*
FROM queue_exec exec
INNER JOIN queue_push push ON push.id = exec.push_id
WHERE push.pushed_at < UNIX_TIMESTAMP(in_min_time);
DELETE
FROM queue_push
WHERE pushed_at < UNIX_TIMESTAMP(in_min_time);
END;;
DELIMITER ;
DROP EVENT IF EXISTS event_to_clear_queue_monitor_deprecated_records;
CREATE EVENT event_to_clear_queue_monitor_deprecated_records
ON SCHEDULE EVERY '1' HOUR
ON COMPLETION PRESERVE
ENABLE
COMMENT 'Event to clear deprecated rows that clears rows one day older.'
DO CALL clear_queue_monitor_deprecated_records(NOW() - INTERVAL 1 DAY);
monitor/clear-deprecated
command should be used with --silent
or --interactive=0
param if you run its by crontab.
Thanks
Do this great package supports some kind of garbage collecting? I mean removing info about execution/.. etc older than day/week/month? Or I need to implement it manually?
I just don't like the idea of increasing db's backups.