I need to launch a long running process through an API call.
I have this:
from frappe.utils.background_jobs import enqueue
: : : :
@frappe.whitelist()
def test_enqueue():
ulog("Enqueuing Long Task")
enqueue('myapp.myapp.doctype.myapp.myapp.longTask', now = True, timeout=120000)
return { "result": "Enqueued Long Task" }
I expected to get the immediate response, {"message":{"result":"Enqueued Long Task"}}.
Instead, I get that response message only when the “enqueued” process completes (after about 10 minutes).
Try to remove now = True
And you can use something like this enqueue(method=make_payment_entry, queue='short', timeout=1000, is_async=True , kwargs =nmb_doc )