Skip to content

optimized decay()#3286

Closed
AnshSinghal wants to merge 2 commits intointelowlproject:developfrom
AnshSinghal:3248
Closed

optimized decay()#3286
AnshSinghal wants to merge 2 commits intointelowlproject:developfrom
AnshSinghal:3248

Conversation

@AnshSinghal
Copy link
Contributor

Closes #3248

Description

Optimized decay() with bulk updates and atomic transaction in queryset.py.
Added tests covering query count reduction and rollback safety in test_queryset.py.

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue).

Copilot AI review requested due to automatic review settings February 7, 2026 09:25
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR optimizes UserEventQuerySet.decay() to reduce per-row database updates and to make the decay operation atomic, adding tests to validate reduced query counts and rollback behavior.

Changes:

  • Reworked UserEventQuerySet.decay() to prefetch related data_model objects and apply updates via bulk_update() inside a transaction.
  • Added a test asserting reduced query counts for bulk decay.
  • Added a test asserting atomic rollback if the bulk update fails.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
api_app/user_events_manager/queryset.py Implements bulk/atomic decay logic and related object fetching strategy.
tests/api_app/user_events_manager/test_queryset.py Adds tests for query-count reduction and transaction rollback safety.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@AnshSinghal
Copy link
Contributor Author

@mlodic please review

@AnshSinghal AnshSinghal closed this by deleting the head repository Feb 13, 2026
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.

1 participant

Comments