@deinossrl/dgp-agent 1.4.58 → 1.4.59
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +11 -0
- package/index.mjs +39 -5
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
# Changelog - DGP Agent
|
|
2
2
|
|
|
3
|
+
## [1.4.59] - 2026-01-12
|
|
4
|
+
|
|
5
|
+
### Added
|
|
6
|
+
- Progreso en tiempo real durante pg_restore
|
|
7
|
+
- Muestra mensaje cada 10 segundos: "Restaurando... (Xs transcurridos)"
|
|
8
|
+
- Muestra tiempo total al finalizar
|
|
9
|
+
|
|
10
|
+
### Changed
|
|
11
|
+
- Cambiado de spawnSync a spawn asíncrono para mejor feedback
|
|
12
|
+
- Mejor experiencia de usuario en restauraciones largas
|
|
13
|
+
|
|
3
14
|
## [1.4.58] - 2026-01-12
|
|
4
15
|
|
|
5
16
|
### Fixed
|
package/index.mjs
CHANGED
|
@@ -2011,16 +2011,50 @@ async function executePgRestore(command) {
|
|
|
2011
2011
|
// Archivo de entrada
|
|
2012
2012
|
pgRestoreArgs.push(localFilePath);
|
|
2013
2013
|
|
|
2014
|
-
// Ejecutar pg_restore
|
|
2014
|
+
// Ejecutar pg_restore con progreso en tiempo real
|
|
2015
2015
|
logCommand(`Ejecutando: pg_restore [conexión oculta]`);
|
|
2016
2016
|
await addCommandLog('command', 'Ejecutando pg_restore...');
|
|
2017
2017
|
|
|
2018
|
-
const
|
|
2019
|
-
|
|
2020
|
-
|
|
2021
|
-
|
|
2018
|
+
const startTime = Date.now();
|
|
2019
|
+
let progressInterval;
|
|
2020
|
+
|
|
2021
|
+
const result = await new Promise((resolve, reject) => {
|
|
2022
|
+
const child = spawn(pgRestorePath, pgRestoreArgs, {
|
|
2023
|
+
env: process.env,
|
|
2024
|
+
stdio: 'pipe',
|
|
2025
|
+
});
|
|
2026
|
+
|
|
2027
|
+
let stdout = '';
|
|
2028
|
+
let stderr = '';
|
|
2029
|
+
|
|
2030
|
+
child.stdout.on('data', (data) => {
|
|
2031
|
+
stdout += data.toString();
|
|
2032
|
+
});
|
|
2033
|
+
|
|
2034
|
+
child.stderr.on('data', (data) => {
|
|
2035
|
+
stderr += data.toString();
|
|
2036
|
+
});
|
|
2037
|
+
|
|
2038
|
+
// Mostrar progreso cada 10 segundos
|
|
2039
|
+
progressInterval = setInterval(() => {
|
|
2040
|
+
const elapsed = Math.floor((Date.now() - startTime) / 1000);
|
|
2041
|
+
logInfo(`Restaurando... (${elapsed}s transcurridos)`);
|
|
2042
|
+
}, 10000);
|
|
2043
|
+
|
|
2044
|
+
child.on('error', (error) => {
|
|
2045
|
+
clearInterval(progressInterval);
|
|
2046
|
+
reject(error);
|
|
2047
|
+
});
|
|
2048
|
+
|
|
2049
|
+
child.on('close', (code) => {
|
|
2050
|
+
clearInterval(progressInterval);
|
|
2051
|
+
resolve({ status: code, stdout, stderr });
|
|
2052
|
+
});
|
|
2022
2053
|
});
|
|
2023
2054
|
|
|
2055
|
+
const elapsed = Math.floor((Date.now() - startTime) / 1000);
|
|
2056
|
+
logInfo(`Restore completado en ${elapsed} segundos`);
|
|
2057
|
+
|
|
2024
2058
|
if (result.error) {
|
|
2025
2059
|
throw new Error(`Error ejecutando pg_restore: ${result.error.message}`);
|
|
2026
2060
|
}
|