Harrison
Harrison

Reputation: 186

Signals VS Celery task

So i have this scenario and quite not sure whether celery is the right tool for the job. I have to track the fifth order placed by a user to give them a coupon. Currently i have implemented a signal on the

@receiver(pre_save, sender=Order)
def pre_save_stuff():
     #this has overhead on db since am excluding customers not in 
     #loyalty progamme.They are many
     do_coupon_stuff()

method. However i have now to exclude a particular group of customers with a query that has overhead slowing the request cycle for this order. Does it make sense to user celery in this scenario?

Upvotes: 0

Views: 445

Answers (1)

itzMEonTV
itzMEonTV

Reputation: 20349

If you want to give coupon in the response itself. You have to do this. Otherwise just give the task to background (celery is an option)

Upvotes: 1

Related Questions