Merge pull request 'Hotfix-create-proc-to-kill-connection' (!2385) from Hotfix-create-proc-to-kill-connection into master
gitea/salix/pipeline/head This commit looks good Details

Reviewed-on: #2385
Reviewed-by: Juan Ferrer <juan@verdnatura.es>
This commit is contained in:
Carlos Andrés 2024-04-30 07:06:43 +00:00
commit 2b6d4198ad
4 changed files with 31 additions and 10 deletions

View File

@ -0,0 +1,13 @@
DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `util`.`connection_kill`(
vConnectionId BIGINT
)
BEGIN
/**
* Kill a connection
*
* @param vConnectionId
*/
KILL vConnectionId;
END$$
DELIMITER ;

View File

@ -30,10 +30,7 @@ BEGIN
-- Si hay colecciones sin terminar, sale del proceso -- Si hay colecciones sin terminar, sale del proceso
CALL collection_get(vUserFk); CALL collection_get(vUserFk);
SELECT (pc.maxNotReadyCollections - COUNT(*)) <= 0, SELECT (pc.maxNotReadyCollections - COUNT(*)) <= 0 INTO vHasTooMuchCollections
pc.collectionAssignLockname
INTO vHasTooMuchCollections,
vLockName
FROM productionConfig pc FROM productionConfig pc
LEFT JOIN tCollection ON TRUE; LEFT JOIN tCollection ON TRUE;
@ -49,7 +46,7 @@ BEGIN
WHERE workerFk = vUserFk; WHERE workerFk = vUserFk;
SET vLockName = CONCAT_WS('/', SET vLockName = CONCAT_WS('/',
vLockName, 'collection_assign',
vWarehouseFk, vWarehouseFk,
vItemPackingTypeFk vItemPackingTypeFk
); );

View File

@ -63,8 +63,7 @@ BEGIN
o.numberOfWagons, o.numberOfWagons,
o.trainFk, o.trainFk,
o.linesLimit, o.linesLimit,
o.volumeLimit, o.volumeLimit
pc.collectionNewLockname
INTO vMaxTickets, INTO vMaxTickets,
vHasUniqueCollectionTime, vHasUniqueCollectionTime,
vWorkerCode, vWorkerCode,
@ -74,15 +73,14 @@ BEGIN
vWagons, vWagons,
vTrainFk, vTrainFk,
vLinesLimit, vLinesLimit,
vVolumeLimit, vVolumeLimit
vLockName
FROM productionConfig pc FROM productionConfig pc
JOIN worker w ON w.id = vUserFk JOIN worker w ON w.id = vUserFk
JOIN state st ON st.`code` = 'ON_PREPARATION' JOIN state st ON st.`code` = 'ON_PREPARATION'
JOIN operator o ON o.workerFk = vUserFk; JOIN operator o ON o.workerFk = vUserFk;
SET vLockName = CONCAT_WS('/', SET vLockName = CONCAT_WS('/',
vLockName, 'collection_new',
vWarehouseFk, vWarehouseFk,
vItemPackingTypeFk vItemPackingTypeFk
); );

View File

@ -0,0 +1,13 @@
ALTER TABLE vn.productionConfig
DROP COLUMN IF EXISTS collectionNewLockname,
DROP COLUMN IF EXISTS collectionAssignLockname;
DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `util`.`connection_kill`()
BEGIN
END$$
DELIMITER ;
GRANT EXECUTE ON PROCEDURE util.connection_kill TO 'developer';