Price rule discount batches getting stuck as 'queued'

New Member
15 0 0

We're managing some large customer accounts who want to create many thousands of unique discount codes per price rule. We are using the DiscountCode batch to create up to 100 discount codes at a time.

 

This works great and the codes are created for us very quickly until we reach about 9,000-10,000 discount codes, after that the batches stall and get stuck with their status as 'queued'.

 

There is no way to delete the stuck batch as far as we can see and creating new batches for the same price rule also get stuck.

 

Here is an example of the response from Shopify when checking the status of a batch created over 6 hours ago:

 

{
    "discount_code_creation": {
        "id": 74805379115,
        "price_rule_id": 557070745643,
        "started_at": null,
        "completed_at": null,
        "created_at": "2019-10-03T05:48:42-04:00",
        "updated_at": "2019-10-03T05:48:42-04:00",
        "status": "queued",
        "codes_count": 100,
        "imported_count": 0,
        "failed_count": 0
    }
}

 

Is this some limitation when creating discount codes using the batch or some issue in the Shopify backend?

 

We can still create new codes for different price rules so the blockage seems to be related to the price rule and not the store.

 

Thanks

 

Mike

0 Likes
New Member
15 0 0

Can anyone from Shopify help us out with this?

 

As far as I can tell its a problem with the Shopify backend but I don't see anything in the status page.

0 Likes
New Member
15 0 0

Hi all, my batch is still queued 4 days after it was created.

 

Can someone from Shopify please take a look at this and confirm if this is a problem with the Shopify backend or if there is some undocumented limit on discount batches?

 

Thanks

0 Likes
Shopify Staff
Shopify Staff
472 35 90

Hi @ant-fx, I'll take a look into this and get back to you.

Developer Experience @ Shopify
0 Likes
New Member
15 0 0

Many thanks Ryan.

 

I deleted the original price rule with that example but I created a new one yesterday (it's pretty easy to reproduce the issue). Here are the new details if you need them. As you can see it was created yesterday but still stuck on 'queued'.

 

Please let me know if you need any other info from my side.

 

{
    "discount_code_creation": {
        "id": 74944184363,
        "price_rule_id": 558145863723,
        "started_at": null,
        "completed_at": null,
        "created_at": "2019-10-07T11:29:03-04:00",
        "updated_at": "2019-10-07T11:29:03-04:00",
        "status": "queued",
        "codes_count": 100,
        "imported_count": 0,
        "failed_count": 0
    }
}
0 Likes
Shopify Staff
Shopify Staff
472 35 90

Does it always occur when you are getting close to 10k codes? Any specific reproduction steps other than creating non stop batches?

Developer Experience @ Shopify
0 Likes
New Member
15 0 0

> Does it always occur when you are getting close to 10k codes?

I'm not sure how significant 10k but it never seems to happen below 10k. In the last example above I was able to get up to 22k before it got stuck.

 

> Any specific reproduction steps other than creating non stop batches?

That's about it really, the only other thing I do is poll the batch status to see if it's finished or not. The loop runs every second to check the status, if the status is complete then it stores the associated discount codes and creates a new batch. If the status is pending it waits a second and tries again.

0 Likes
Shopify Staff
Shopify Staff
472 35 90

Thanks again @ant-fx for the info.

 

The team has identified that there are definitely some jobs getting stuck, and are digging deeper into it.  Unfortunately I don't have a short term solution for you at the moment.  I'll update you when I know more.

Developer Experience @ Shopify
0 Likes
Highlighted
New Member
15 0 0

Great, thanks Ryan.

0 Likes