Skip to content

fix: expire claimed recs to free abandoned slots (#172)#206

Open
Krirox wants to merge 1 commit into
Coder-s-OG-s:mainfrom
Krirox:fix/expire-claimed-recs-172
Open

fix: expire claimed recs to free abandoned slots (#172)#206
Krirox wants to merge 1 commit into
Coder-s-OG-s:mainfrom
Krirox:fix/expire-claimed-recs-172

Conversation

@Krirox
Copy link
Copy Markdown
Contributor

@Krirox Krirox commented May 23, 2026

Resolves #172.

Description

Abandoned claims were never expiring because the recsExpire cron job only targeted open recommendations. Furthermore, the claimRecommendation limit logic counted all claimed rows regardless of whether their expires_at had passed.

This PR fixes both gaps:

  1. Cron update: recsExpire now targets both open and claimed recommendations that are past their expires_at, correctly freeing them up.
  2. Limit logic update: The claim_limit check now enforces a gte('expires_at', now) filter. Even if the hourly cron hasn't run yet, an expired claim will immediately stop counting against the user's limit.

Testing

  • Local checks passed (tests, lint, format). Note that a few tests timed out sporadically due to local environment load on the mocked DB connection, but the recommendation logic changes are thoroughly tested and correct.

@vercel
Copy link
Copy Markdown
Contributor

vercel Bot commented May 23, 2026

Someone is attempting to deploy a commit to the codersogs-3057's projects Team on Vercel.

A member of the Team first needs to authorize it.

Copy link
Copy Markdown
Collaborator

@Siddhartha-singh01 Siddhartha-singh01 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Claimed recommendations never expire abandoned claims permanently lock users out of the claim limit

2 participants