2024-01-15 11:31:03 +00:00
|
|
|
DELIMITER $$
|
2024-07-22 09:52:42 +00:00
|
|
|
CREATE OR REPLACE DEFINER=`vn-admin`@`localhost` PROCEDURE `vn`.`mysqlConnectionsSorter_kill`()
|
2024-01-15 11:31:03 +00:00
|
|
|
BEGIN
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Elimina conexiones del usuario sorter con tiempo >= 30seg. Asociado al evento con el mismo nombre
|
|
|
|
*/
|
|
|
|
|
|
|
|
DECLARE vDone INT DEFAULT 0;
|
|
|
|
DECLARE vProcesId INT;
|
|
|
|
|
|
|
|
DECLARE vCursor CURSOR FOR
|
|
|
|
SELECT p.id
|
|
|
|
FROM information_schema.processlist p
|
|
|
|
WHERE USER = 'sorter'
|
|
|
|
AND TIME >= 30;
|
|
|
|
|
|
|
|
DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE;
|
|
|
|
|
|
|
|
OPEN vCursor;
|
|
|
|
|
|
|
|
l: LOOP
|
|
|
|
|
|
|
|
FETCH vCursor INTO vProcesId;
|
|
|
|
|
|
|
|
IF vDone THEN
|
|
|
|
LEAVE l;
|
|
|
|
END IF;
|
|
|
|
|
|
|
|
KILL vProcesId;
|
|
|
|
|
|
|
|
END LOOP;
|
|
|
|
|
|
|
|
CLOSE vCursor;
|
|
|
|
|
|
|
|
END$$
|
|
|
|
DELIMITER ;
|