When starting a task the id is saved to the database, this is used later for getting the user's queued task that is running so it can be deleted, but when it is deleted the task is still running even though the Django-q database is shown to be empty in Django admin. Any help would be greatly appreciated thanks.
function in views for starting task
async_id = async_task("themisapp.bot.custombot",ind, sind, name, coin1, coin2, interval, sender, Key, coin_hash, starting, coin_hash2, user_id)
tx_hash = 'Bot Running'
orm = OrmQ.objects.all()
q_task = orm[len(orm)-1]
task_id = int(q_task.id)
task = Task( user_id = request.user.id, async_id = task_id )
task.save()
Function in Views For deleting queued task
if request.method == 'POST' and request.POST.get('form_type') == 'trade_cancel':
try:
live = Live.objects.get(user_id=request.user.id)
live.delete()
task_id = request.user.task.async_id
q = OrmQ.objects.get(id=task_id)
q.delete()
task = Task.objects.get(user_id=request.user.id)
task.delete()
tx_hash = 'Successfully Stopped Bot'
except:
tx_hash = 'No Bot Currently Running'
Q-Cluster Settings
Q_CLUSTER = {
'name': 'DjangORM',
'workers': 8,
'timeout':604800,
'retry': 604801,
'queue_limit': 100,
'bulk': 20,
'orm': 'default',
}