A whitelisted function that uses enqueue(aMethod) responds only when queued job ends

I need to launch a long running process through an API call.

I have this:

from frappe.utils.background_jobs import enqueue
     :     :     :     :
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).

Have I misunderstood something?


  1. Version: ERPNext V13.beta.6
  2. in ${benchDir}/config/supervisor.conf
     :     :     :     :
command=/home/erpdev/frappe-bench-DENH/env/bin/gunicorn -b -w 4 -t 120 frappe.app:application --preload
     :     :     :     :

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 )


That did the trick.

Waaaaay too easy to assume async would be the default, no?