fix(): repetitions timestamp index on collection creation#649
Open
fix(): repetitions timestamp index on collection creation#649
Conversation
neSpecc
approved these changes
May 5, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
Adds a missing MongoDB index for newly created repetitions:<projectId> collections so queries filtering by timestamp (e.g., billing-period counting / limiter workloads) don’t degrade into collection scans, reducing CPU/memory pressure.
Changes:
- Create a
timestampindex on the per-projectrepetitions:<projectId>collection during project creation. - Bump package version from
1.4.13to1.4.14.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
src/resolvers/project.js |
Adds creation of a timestamp index on repetitions:<projectId> when a project (and its collections) is created. |
package.json |
Version bump to 1.4.14. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Agent-Logs-Url: https://github.com/codex-team/hawk.api.nodejs/sessions/5237af31-c1bb-495f-a4d2-c59bf81d4ccc Co-authored-by: neSpecc <3684889+neSpecc@users.noreply.github.com>
Agent-Logs-Url: https://github.com/codex-team/hawk.api.nodejs/sessions/5237af31-c1bb-495f-a4d2-c59bf81d4ccc Co-authored-by: neSpecc <3684889+neSpecc@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Limiter query that counts documents with timestamp
$gtbilling period start was a collscan because we did not have indexes on creation of the newrepetitions:<projectId>collectionsthis kind of queries (and not only in limiter) led to memory pressure and high cpu usage