1) I use frappe.enqueue() to run a method. And after this enqueue finish I want to run another method (not enqueued). But since the enqueue takes some times, the second method runs before the enqueued method finish.
How to wait for the first enqueue to finish and then run the second method?
2) On other case, if I have a set of enqueues that runs together (e.g because 2 users click the same button at almost the same time):
def button_click(): enqueue(third_method) #while this method runs for user1, user2 clicks the button so it's also enqueued for user2 enqueue(fourth_method)
So to illustrate the background jobs will be like this:
third_method(user1) third_method(user2) fourth_method(user1) fourth_method(user2)
how do I make the
fourth_method(user1) to run right after the
third_method(user1) finish, without waiting for the
third_method(user2) to finish?
I hope my description and questions are clear. Thank you