我有一个基于web的python工具,用于使用SVN checkout构建软件
一旦结帐和测试完成,我就删除了记录。删除记录时,必须删除所有签出文件以及DB行。但这些签出非常大(以GBs为单位),所以当我在浏览器中单击delete时,它会首先删除DB表中的行,但文件删除需要更多的时间,大约需要1到2分钟。我尝试了删除数据库后的threading
调用返回浏览器并继续删除文件。但这没用
我尝试了以下代码:
import threading
def data_delete(inputs):
# call function to take delete the database rows
deleteDataBaseRows_function(inputs)
id1 = 1
id2 = 2
# call the maintainence_function here
t = threading.Thread(target=deletefiles_function, args=[id1, id2])
# setDaemon=False to stop the thread after complete
t.setDaemon(False)
# starting the thread
t.start()
# return response/anything-else you want to return
return "it worked"
def deleteDataBaseRows_function(inputs):
# deleting the database process here
print "table rows deleted"
def deletefiles_function(id1, id2):
print "Files are deleted"
res = profile_update("inputs")
print res
我得到了以下输出:
table rows deleted
Files are deleted
response to the browser
但我的预期行为是在删除数据库行之后,用户应该继续在浏览器工具上执行其他工作(否则他必须等到完成整个文件删除),在后端,文件开始删除它
table rows deleted
response to the browser
Files are deleted
目前没有回答
相关问题 更多 >
编程相关推荐