From 6d58ebdff16037f2ba47a3b5cc3d9315c5219e55 Mon Sep 17 00:00:00 2001 From: Md Sadique Inam <104680493+mdsadique-inam@users.noreply.github.com> Date: Sun, 12 May 2024 02:19:27 +0530 Subject: [PATCH] replaced Promise.all with for loop the `Promise.all` creates the deadlock causing the command `db:truncate` to throw error deadlock detected --- commands/db_truncate.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/commands/db_truncate.ts b/commands/db_truncate.ts index d0dc5bf1..7ae688c4 100644 --- a/commands/db_truncate.ts +++ b/commands/db_truncate.ts @@ -59,7 +59,9 @@ export default class DbTruncate extends BaseCommand { let tables = await client.getAllTables(schemas) tables = tables.filter((table) => !['adonis_schema', 'adonis_schema_versions'].includes(table)) - await Promise.all(tables.map((table) => client.truncate(table, true))) + for (const table of tables) { + await client.truncate(table, true) + } this.logger.success('Truncated tables successfully') }