使用 multiprocessing 库在子进程中进行数据库调用时,我遇到了以下错误:
访问:Pastie
InternalError: current transaction is aborted, commands ignored until end of transaction block
这是在 web.py
中使用 psycopg2
驱动连接到 Postgre 数据库时出现的。
然而,如果我使用 threading.Thread
而不是 multiprocessing.Process
,就不会出现此错误。
您有什么解决方法吗?