await storage.run({ action: "usage" });storage.run(action="usage")¿Por qué preguntar antes de escribir
Una escritura pasada el espacio del plan se rechaza con quota_exceeded. Lee y elimina sigue funcionando — esa asimetría es deliberada, por lo que siempre se puede obtener datos y hacer espacio — pero una escritura que falla a mitad de un lote te deja para averiguar qué aterrizó.
const before = await storage.run({ action: "usage" });
// Write in batches, and stop on the first refusal rather than pushing through
for (const batch of batches) {
try {
await storage.run({ action: "insert", collection, documents: JSON.stringify(batch) });
} catch (err) {
if (err.code === "quota_exceeded") break;
throw err;
}
}import json
from iagenify import IaGenifyError
before = storage.run(action="usage")
# Write in batches, and stop on the first refusal rather than pushing through
for batch in batches:
try:
storage.run(action="insert", collection=collection, documents=json.dumps(batch))
except IaGenifyError as error:
if error.code == "quota_exceeded":
break
raiseEste almacenamiento, o la cuenta
| Pregunta | Preguntar |
|---|---|
| ¿Qué tan lleno está éste? | ejecutar({ acción: "usar" }) |
| ¿Qué es lo que el plan da, entre servicios? | api.cloud.usage() |
| ¿Qué archivos están tomando el espacio? | api.files.list(), y ordenar por tamaño |
La vista a nivel de cuenta es la que te dice si comprar espacio ayudaría, porque ahí es donde vive la asignación del plan.