fix: handle race condition to catch recreation base containers

This commit is contained in:
Mauricio Siu
2025-02-15 14:23:54 -06:00
parent 3a7bb5016c
commit 871931b460
3 changed files with 24 additions and 4 deletions

View File

@@ -53,7 +53,14 @@ export const initializeRedis = async () => {
});
console.log("Redis Started ✅");
} catch (error) {
await docker.createService(settings);
try {
await docker.createService(settings);
} catch (error: any) {
if (error?.statusCode !== 409) {
throw error;
}
console.log("Redis service already exists, continuing...");
}
console.log("Redis Not Found: Starting ✅");
}
};