Skip to content

Memoize session.aggregation_key#1892

Merged
sl0thentr0py merged 2 commits intomasterfrom
neel/fix-session-aggregation-key
Sep 14, 2022
Merged

Memoize session.aggregation_key#1892
sl0thentr0py merged 2 commits intomasterfrom
neel/fix-session-aggregation-key

Conversation

@sl0thentr0py
Copy link
Copy Markdown
Member

@sl0thentr0py sl0thentr0py commented Sep 14, 2022

probably fixes #1891

(this is the only hypothesis I have currently for that error happening)

@sl0thentr0py sl0thentr0py requested a review from st0012 September 14, 2022 11:36
@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Sep 14, 2022

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.39%. Comparing base (67bbcd7) to head (85fba72).
⚠️ Report is 641 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1892      +/-   ##
==========================================
- Coverage   98.40%   98.39%   -0.02%     
==========================================
  Files         148      148              
  Lines        8886     8885       -1     
==========================================
- Hits         8744     8742       -2     
- Misses        142      143       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Copy Markdown
Contributor

@st0012 st0012 left a comment

Choose a reason for hiding this comment

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

Please also add a changelog entry, thx

@pending_aggregates[session.aggregation_key] ||= init_aggregates(session.aggregation_key)
@pending_aggregates[session.aggregation_key][session.status] += 1

aggregation_key = session.aggregation_key
Copy link
Copy Markdown
Contributor

@st0012 st0012 Sep 14, 2022

Choose a reason for hiding this comment

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

Should the aggregation_key method memoizes its value then? Or should we rename it to generate_aggregation_key?

The fact that a *_key method generates different value every time it's called feels like a trap to me.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

wait no, I was just fixing this blindly. The key should not change because it always picks started, wtf.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I'm not sure how else this error could happen then, I will memoize anyway and let's see if it fixes this user's problem.

@sl0thentr0py sl0thentr0py force-pushed the neel/fix-session-aggregation-key branch from 403daeb to dedd055 Compare September 14, 2022 11:49
@sl0thentr0py sl0thentr0py changed the title Fix session.aggregation_key being different due to changing timestamps Memoize session.aggregation_key Sep 14, 2022
@sl0thentr0py sl0thentr0py merged commit d872488 into master Sep 14, 2022
@sl0thentr0py sl0thentr0py deleted the neel/fix-session-aggregation-key branch September 14, 2022 12:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

undefined method `[]' for nil:NilClass in session.flusher.rb

3 participants