flask-sqlalchemy 多线程使用问题

如图,在视图函数中调用getAllServers获取到server对象列表,然后多线程执行doPoweron的时候报错,请问各位大佬应该在哪里加上 with currentapp.get_contex()么