Typeorm getconnection in a forked process

151 Views Asked by At

I have the following use case:

Within the separate process, I need to do some tasks and then connect via Typeorm to Mongodb to update state based on those tasks. However, since it is a separate process, doing getConnection with TypeORM does not work - in the sense that, if I have created any connections in the parent process, I cannot access them in this separate process. I assume because, as it is a separate process, it does not share any of the memory from the parent process (unless things like connections are explicitly copied over? not sure).

I am wondering if there is a way around this? Or would I just need to manage connections within this separate process? Any recommendations on how to do that without overloading the DB with just a bunch of standalone connections being created?

Thank you.

0

There are 0 best solutions below