How to increase the background task?

Hello Community.
Note: I’m using ERPNext-13 Version

When I’m practice the the Stock Module in the Item doctype I can see a feature Create Multiple Variant Through that feature I can create Multiple Varaint for a Template. That’s cool feature that’s all fine.

If I’m trying to create more than 500 Variant its shows this error.

Please do not create more than 500 items at a time

But In any case I want to increase the count what is the possible solutions.


  • I know its a whitelist function we ca override I will override
  • I know Directly copy and paste and modify in the Custom App

But my questions some how frappe restricting the Creation of more that 500. because its affect the database Load and performance. I want to know If I increase that count. what is the issue may happen from the database site.

  • What is the best way to optimise?
  • If I increase, what will happen? in the load and perfomance perspective?
  • Is there any possibility for the database crash?

More Details.

Here that Feature button picture in the Item Doctype

Here the file path


This is the funtion

def enqueue_multiple_variant_creation(item, args):
	# There can be innumerable attribute combinations, enqueue
	if isinstance(args, string_types):
		variants = json.loads(args)
	total_variants = 1
	for key in variants:
		total_variants *= len(variants[key])
	if total_variants >= 600:
		frappe.throw(_("Please do not create more than 500 items at a time"))
	if total_variants < 10:
		return create_multiple_variants(item, args)
		return "queued"

Please post your suggestion.


Please kindly share your thoughts

@revant_one @rmehta

Please give me some suggestion.

in this line I made the changes like this


I just added queue='long' its gives 25min for the background task. we can create custom queue options also here the detailed documentation

1 Like

Thank you so much for your own solution.

I’m having this problem right now, where I reached 2400 variations and it takes so much time to create more. I wonder what other tips and recommendations are there for this problem.