Fix a bug in usertask.py

avoid duplicate insertion in database in case the task fails