Skip to content

Commit a1db4e8

Browse files
committed
fix: fix memory leak in cron db refresh
Identity Map is forked in requests, but not in cron job. Should be forked manually
1 parent 339275a commit a1db4e8

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/maintenance/database-manager.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,12 @@ export class DatabaseManager {
4141
}
4242

4343
async refresh(em: EntityManager) {
44-
return em.transactional(async (_em) => {
44+
return em.fork().transactional(async (_em) => {
4545
const ctx: Transaction = _em.getTransactionContext();
4646
await this.dropSchema(_em, ctx);
4747
await this.createSchema(_em, ctx);
4848
await this.seed(_em);
49+
_em.clear();
4950
return true;
5051
});
5152
}

0 commit comments

Comments
 (0)