problem description
celery uses prefork mode (4 processes) and is used in conjunction with psycopg2. Each startup can successfully complete a celery task. InterfaceError: cursor already closed
appears when the second task is carried out. What should be done?
what methods have you tried
as you can see in the psycopg2 document , this library should not be used in forked process. So I"m a little confused, is it because of celery"s prefork mode that caused the problem? So how should I handle it? Do you need to create a new database link in each celery task and turn it off after you finish it?