Gioobc commited on
Commit
ec85345
·
verified ·
1 Parent(s): 5273cd2

minor changes for improved lecture

Browse files
Files changed (1) hide show
  1. index.js +10 -3
index.js CHANGED
@@ -57,6 +57,13 @@ async function startSimpleWorker() {
57
  const localZipPath = path.join(TEMP_DIR, zipName);
58
  const remoteZipPath = path.posix.join(regionPath, zipName);
59
 
 
 
 
 
 
 
 
60
  console.log(`📦 Descargando ${zipName}...`);
61
  await fetcher.fetchFile(remoteZipPath, localZipPath);
62
 
@@ -67,9 +74,9 @@ async function startSimpleWorker() {
67
  console.log(`❌ Error unzip: ${e.message}`);
68
  }
69
 
70
- // Borramos el zip para no llenar el disco
71
- fs.unlinkSync(localZipPath);
72
- console.log(`✨ ${zipName} listo.`);
73
  }
74
  }
75
  } catch (err) {
 
57
  const localZipPath = path.join(TEMP_DIR, zipName);
58
  const remoteZipPath = path.posix.join(regionPath, zipName);
59
 
60
+ // LIMPIEZA: Para no llenar el disco de 50GB, borramos lo anterior antes de cada ZIP nuevo
61
+ console.log(`🧹 Limpiando espacio para ${zipName}...`);
62
+ const oldFiles = fs.readdirSync(STORAGE_DIR);
63
+ for (const f of oldFiles) {
64
+ try { fs.unlinkSync(path.join(STORAGE_DIR, f)); } catch(e) {}
65
+ }
66
+
67
  console.log(`📦 Descargando ${zipName}...`);
68
  await fetcher.fetchFile(remoteZipPath, localZipPath);
69
 
 
74
  console.log(`❌ Error unzip: ${e.message}`);
75
  }
76
 
77
+ // Borramos el zip inmediatamente
78
+ if (fs.existsSync(localZipPath)) fs.unlinkSync(localZipPath);
79
+ console.log(`✨ ${zipName} listo para auditar.`);
80
  }
81
  }
82
  } catch (err) {