# Long time to mark stage as complete

**URL:** <https://forum.codecrafters.io/t/long-time-to-mark-stage-as-complete/4962>\
**Category:** Bug Reports\
**Created:** [February 18, 2025, 12:55am UTC](https://forum.codecrafters.io/t/long-time-to-mark-stage-as-complete/4962 "2025-02-18T00:55:06Z")\
**Posts on this page:** 17\
**Page:** 1

<div class="post-metadata">

**Author:** ![i27ae15](https://yyz1.discourse-cdn.com/flex003/user_avatar/forum.codecrafters.io/i27ae15/32/3295_2.png) [@i27ae15](https://forum.codecrafters.io/u/i27ae15)\
**Post date:** [February 18, 2025, 12:55am UTC](https://forum.codecrafters.io/t/long-time-to-mark-stage-as-complete/4962/1 "2025-02-18T00:55:06Z")

</div>

Everytime I finish a stage I have to wait about 15 minutes to be able to start the following. I click on “mark stage as complete”:

 ![image](https://canada1.discourse-cdn.com/flex003/uploads/codecrafters/original/2X/a/a66e8ce5df005f519a52a1a92b1704d9c7e8dccb.png)

For instace I just finished “Respond with body #CN2” in HTTP Server and I’ve been waiting for more than 10 minutes to be able to start the next one “Read header #FS3”.

And if I try to run the CLI `codecrafters test` I got 503.

Edit: took about 30 minutes for the stage to be marked as completed.

---

<div class="post-metadata">

**Author:** ![rohitpaulk](https://yyz1.discourse-cdn.com/flex003/user_avatar/forum.codecrafters.io/rohitpaulk/32/6_2.png) [@rohitpaulk](https://forum.codecrafters.io/u/rohitpaulk)\
**Post date:** [February 18, 2025, 1:45am UTC](https://forum.codecrafters.io/t/long-time-to-mark-stage-as-complete/4962/2 "2025-02-18T01:45:31Z")

</div>

@i27ae15 hmm, it definitely shouldn’t take that long. I assume you’ve tried this already, but if you reload the page and click the button again does it still get stuck in the loading state?

I just checked and it doesn’t look like we have a handler for an error here, so if there’s an intermittent network failure it’ll “look” like the thing is loading, but in reality it’s just a failed request. We’ll add this. In the meantime, would be good to know whether reloading the page and clicking the button again works or not.

---

<div class="post-metadata">

**Author:** ![i27ae15](https://yyz1.discourse-cdn.com/flex003/user_avatar/forum.codecrafters.io/i27ae15/32/3295_2.png) [@i27ae15](https://forum.codecrafters.io/u/i27ae15)\
**Post date:** [February 18, 2025, 1:56am UTC](https://forum.codecrafters.io/t/long-time-to-mark-stage-as-complete/4962/3 "2025-02-18T01:56:16Z")

</div>

@rohitpaulk yep, tried multiple times and still got the same issue, it just hangs there as well as the CLI, also closed and open codecrafters again but doing the same.

---

<div class="post-metadata">

**Author:** ![i27ae15](https://yyz1.discourse-cdn.com/flex003/user_avatar/forum.codecrafters.io/i27ae15/32/3295_2.png) [@i27ae15](https://forum.codecrafters.io/u/i27ae15)\
**Post date:** [February 18, 2025, 1:59am UTC](https://forum.codecrafters.io/t/long-time-to-mark-stage-as-complete/4962/4 "2025-02-18T01:59:37Z")

</div>

@rohitpaulk if this helps, I closed codecrafters and tried to run tests, but still was getting this issue, after about 30 minutes I tried again and the runner started, went back to codecrafters, clicked on “complete stage” and was marked instantly.

---

<div class="post-metadata">

**Author:** ![i27ae15](https://yyz1.discourse-cdn.com/flex003/user_avatar/forum.codecrafters.io/i27ae15/32/3295_2.png) [@i27ae15](https://forum.codecrafters.io/u/i27ae15)\
**Post date:** [February 20, 2025, 11:39pm UTC](https://forum.codecrafters.io/t/long-time-to-mark-stage-as-complete/4962/7 "2025-02-20T23:39:07Z")

</div>

@rohitpaulk

Following on this, still having the same issue.

I just completed another stage and it has been haging on “Mark stage as complete” for about 10 minutes.

 ![image](https://canada1.discourse-cdn.com/flex003/uploads/codecrafters/original/2X/9/9185eb204a43c60790725c3b5322e148f7a8c21b.png)

This returned a 503 after 6 minutes:

 ![image](https://canada1.discourse-cdn.com/flex003/uploads/codecrafters/original/2X/8/8ebc762f7852c5994c2f06882cb0a584a88b0c81.png)

The stage was marked as completed after almost 15 minutes.

---

<div class="post-metadata">

**Author:** ![rohitpaulk](https://yyz1.discourse-cdn.com/flex003/user_avatar/forum.codecrafters.io/rohitpaulk/32/6_2.png) [@rohitpaulk](https://forum.codecrafters.io/u/rohitpaulk)\
**Post date:** [February 21, 2025, 10:32am UTC](https://forum.codecrafters.io/t/long-time-to-mark-stage-as-complete/4962/8 "2025-02-21T10:32:49Z")

</div>

@i27ae15 Okay can confirm that something’s up here! Just filtered for outlier transactions and I see that the endpoint takes **minutes** for your username specifically:

 ![Screenshot 2025-02-21 at 02.30.37](https://canada1.discourse-cdn.com/flex003/uploads/codecrafters/original/2X/4/4f8357e722ff509efa5229735155c7bcb60110ff.png)

 ![Screenshot 2025-02-21 at 02.29.57](https://canada1.discourse-cdn.com/flex003/uploads/codecrafters/original/2X/f/f183fc531bc2d9b4e06d086d771d94c4449fcbe9.png)

The p95 for this endpoint is 500ms, so this is definitely not expected. We’re going to dig in and figure out what the root cause is – will keep you posted!

---

<div class="post-metadata">

**Author:** ![rohitpaulk](https://yyz1.discourse-cdn.com/flex003/user_avatar/forum.codecrafters.io/rohitpaulk/32/6_2.png) [@rohitpaulk](https://forum.codecrafters.io/u/rohitpaulk)\
**Post date:** [February 21, 2025, 11:02am UTC](https://forum.codecrafters.io/t/long-time-to-mark-stage-as-complete/4962/9 "2025-02-21T11:02:14Z")

</div>

@i27ae15 we’ve pushed a fix for this, could you try this out the next time you complete a stage, lmk if the issue still persists?

Context on what was wrong:

We’ve got some logic to compute badge awards, and this usually only triggers in early stages. It’s got a query that just fetches all submissions until then. This is usually fast since there are only 10s of “submissions” to deal with.

In your case, we ended up in a situation where the logic was being triggered even in later stages (when there are ~1000s of submissions). The innocent query was now fetching 1000s of records, and related records, and running computations on them – all within that “mark stage as complete” request.

We fixed this by **(a)** Optimizing the logic to only pull the last 100 submissions **(b)** Changing the endpoint to commit the “completion” early, and then compute awards. So now, even if the award computation does happen to take longer due to a similar bug in the future, if you refresh your page you should see the stage marked as completed.

* * *

Thanks so much for taking the time to report this!

---

<div class="post-metadata">

**Author:** ![i27ae15](https://yyz1.discourse-cdn.com/flex003/user_avatar/forum.codecrafters.io/i27ae15/32/3295_2.png) [@i27ae15](https://forum.codecrafters.io/u/i27ae15)\
**Post date:** [February 21, 2025, 11:23pm UTC](https://forum.codecrafters.io/t/long-time-to-mark-stage-as-complete/4962/10 "2025-02-21T23:23:58Z")

</div>

@rohitpaulk Thank you! Will check this on Monday and let you know!

---

<div class="post-metadata">

**Author:** ![i27ae15](https://yyz1.discourse-cdn.com/flex003/user_avatar/forum.codecrafters.io/i27ae15/32/3295_2.png) [@i27ae15](https://forum.codecrafters.io/u/i27ae15)\
**Post date:** [February 26, 2025, 12:15am UTC](https://forum.codecrafters.io/t/long-time-to-mark-stage-as-complete/4962/11 "2025-02-26T00:15:13Z")

</div>

@rohitpaulk sorry for the delay, I was waiting for my employer to pay my subscription.

Just completed another stage and it was “mark as complete” instantly, thank you!

---

<div class="post-metadata">

**Author:** ![rohitpaulk](https://yyz1.discourse-cdn.com/flex003/user_avatar/forum.codecrafters.io/rohitpaulk/32/6_2.png) [@rohitpaulk](https://forum.codecrafters.io/u/rohitpaulk)\
**Post date:** [February 26, 2025, 2:31am UTC](https://forum.codecrafters.io/t/long-time-to-mark-stage-as-complete/4962/12 "2025-02-26T02:31:32Z")

</div>

Awesome, glad to hear it worked!

---

<div class="post-metadata">

**Author:** ![i27ae15](https://yyz1.discourse-cdn.com/flex003/user_avatar/forum.codecrafters.io/i27ae15/32/3295_2.png) [@i27ae15](https://forum.codecrafters.io/u/i27ae15)\
**Post date:** [February 26, 2025, 10:34pm UTC](https://forum.codecrafters.io/t/long-time-to-mark-stage-as-complete/4962/13 "2025-02-26T22:34:36Z")

</div>

@rohitpaulk Found another issue!

I just completed another stage, and yes, the stage is marked as completed almost instantly, but I have to wait about 10-15 minutes to be able to start running tests for the next stage, also, same happens when I try to enable/disable an extension, it just hangs.

This is for disabling an extension:

 ![image](https://canada1.discourse-cdn.com/flex003/uploads/codecrafters/original/2X/3/3c6536f4a4f13c2b2fdf9d187e04333529587a71.png)  
 ![image](https://canada1.discourse-cdn.com/flex003/uploads/codecrafters/original/2X/5/55e53734f949164a6a8fa81bd99bea1c45463343.jpeg)

And then for running tests I just get a 503.

---

<div class="post-metadata">

**Author:** ![rohitpaulk](https://yyz1.discourse-cdn.com/flex003/user_avatar/forum.codecrafters.io/rohitpaulk/32/6_2.png) [@rohitpaulk](https://forum.codecrafters.io/u/rohitpaulk)\
**Post date:** [February 26, 2025, 11:35pm UTC](https://forum.codecrafters.io/t/long-time-to-mark-stage-as-complete/4962/14 "2025-02-26T23:35:37Z")

</div>

Yikes, thanks for sharing - looking into this!

---

<div class="post-metadata">

**Author:** ![rohitpaulk](https://yyz1.discourse-cdn.com/flex003/user_avatar/forum.codecrafters.io/rohitpaulk/32/6_2.png) [@rohitpaulk](https://forum.codecrafters.io/u/rohitpaulk)\
**Post date:** [February 27, 2025, 8:10pm UTC](https://forum.codecrafters.io/t/long-time-to-mark-stage-as-complete/4962/15 "2025-02-27T20:10:45Z")

</div>

@i27ae15 we’re still not completely sure what’s up here, but the symptoms you’re mentioning points towards our locking strategy - we use locks on a “repository” for a bunch of actions, one of them being activating/deactivating extensions. The action itself is cheap & quick, but if something else was holding the lock for a while it could result in huge delays.

We’ve changed the locks for activating deactivating extensions to be more granular, so that shouldn’t be slow now. Still looking into the root cause though, I don’t see any Sentry traces yet (could be sampling) so can’t quite tell what’s up. We’ll work on similarly patching the test runner locks too so that it isn’t slow.

---

<div class="post-metadata">

**Author:** ![i27ae15](https://yyz1.discourse-cdn.com/flex003/user_avatar/forum.codecrafters.io/i27ae15/32/3295_2.png) [@i27ae15](https://forum.codecrafters.io/u/i27ae15)\
**Post date:** [February 27, 2025, 11:03pm UTC](https://forum.codecrafters.io/t/long-time-to-mark-stage-as-complete/4962/16 "2025-02-27T23:03:58Z")

</div>

@rohitpaulk Thank you! I will keep an eye on frontend to see if I can catch any errors there.

---

<div class="post-metadata">

**Author:** ![i27ae15](https://yyz1.discourse-cdn.com/flex003/user_avatar/forum.codecrafters.io/i27ae15/32/3295_2.png) [@i27ae15](https://forum.codecrafters.io/u/i27ae15)\
**Post date:** [February 28, 2025, 9:18pm UTC](https://forum.codecrafters.io/t/long-time-to-mark-stage-as-complete/4962/17 "2025-02-28T21:18:43Z")

</div>

@rohitpaulk Updating this:

This bug seems to be affecting many things, I just completed the HTTP Server and this is what I see in my profile:

 ![image](https://canada1.discourse-cdn.com/flex003/uploads/codecrafters/original/2X/4/4aa8cc27815d74d24132f15af6f709d67b65bed9.png)

And this is what I see in my catalog of challenges:

 ![image](https://canada1.discourse-cdn.com/flex003/uploads/codecrafters/original/2X/b/b8d38638553e956047fd30e5358c2fefaf09a5cd.png)

This one is very funny, do you get this data from different sources?  
Edit: It took about 10 - 15 to get synchronized both in my profile and the challenges catalog section. So, same issue as you mentioned I guess.

* * *

Still between challenges I have to wait 10 - 15 minutes to start testing the next one, this is what I get in between:

 ![image](https://canada1.discourse-cdn.com/flex003/uploads/codecrafters/original/2X/8/81790c4535c148fc61cf76d5069d426d9e4db7b7.png)

Also, I am wondering, you mentioned that the hanging issue was due to a logic you got to give badges, I haven’t been granted any badge in a while, and in that section, I see this:

 ![image](https://canada1.discourse-cdn.com/flex003/uploads/codecrafters/original/2X/8/82c10fd2c2cf56bc01618ec6a6c42a9226cd7a64.png)

It says blocked but I can see the text and I can’t see the text for the others that are blocked (might be expected of course).

I don’t know if it’s because I haven’t been able to achieve any new one or this is relevant to the issue.

---

<div class="post-metadata">

**Author:** ![andy1li](https://yyz1.discourse-cdn.com/flex003/user_avatar/forum.codecrafters.io/andy1li/32/10_2.png) [@andy1li](https://forum.codecrafters.io/u/andy1li)\
**Post date:** [July 13, 2025, 12:17am UTC](https://forum.codecrafters.io/t/long-time-to-mark-stage-as-complete/4962/18 "2025-07-13T00:17:13Z")

</div>

Closing this thread due to inactivity. If you still need assistance, feel free to reopen or start a new discussion!

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex003/uploads/codecrafters/original/3X/7/0/700657133935c15703e22c7c8870394f6e6dc27d.svg) [@system](https://forum.codecrafters.io/u/system)\
**Post date:** [July 20, 2025, 12:17am UTC](https://forum.codecrafters.io/t/long-time-to-mark-stage-as-complete/4962/19 "2025-07-20T00:17:34Z")

</div>

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.
