Understanding postgres.js connection management in Trigger.dev v3 #2218
              
                Unanswered
              
          
                  
                    
                      leedia-tech
                    
                  
                
                  asked this question in
                Q&A
              
            Replies: 0 comments
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment
  
        
    
Uh oh!
There was an error while loading. Please reload this page.
-
I'm using postgres.js and noticed your Drizzle example creates the db instance outside the task.
I'm wondering:
Task isolation: Do tasks run in separate workers/processes, or share the same Node process?
Connection lifecycle: If I create a postgres instance outside the task:
Is this instance shared across all executions, or does each worker get its own?
Connection cleanup: postgres.js requires
sql.end()to properly close connections. Should I handle this cleanup or does the worker lifecycle manage it?Beta Was this translation helpful? Give feedback.
All reactions