Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: enhance replay #2984

Merged
merged 6 commits into from
Sep 18, 2023
Merged

Conversation

acpana
Copy link
Contributor

@acpana acpana commented Aug 31, 2023

fixes #2983

Signed-off-by: Alex Pana <8968914+acpana@users.noreply.github.com>
@codecov-commenter
Copy link

codecov-commenter commented Aug 31, 2023

Codecov Report

Patch coverage has no change and project coverage change: -0.03% ⚠️

Comparison is base (83ca660) 52.55% compared to head (187ff46) 52.52%.
Report is 1 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2984      +/-   ##
==========================================
- Coverage   52.55%   52.52%   -0.03%     
==========================================
  Files         134      134              
  Lines       11901    11920      +19     
==========================================
+ Hits         6254     6261       +7     
- Misses       5155     5169      +14     
+ Partials      492      490       -2     
Flag Coverage Δ
unittests 52.52% <0.00%> (-0.03%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Changed Coverage Δ
pkg/cachemanager/cachemanager.go 37.13% <0.00%> (-2.79%) ⬇️

... and 4 files with indirect coverage changes

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

@acpana acpana marked this pull request as ready for review September 1, 2023 06:36
Copy link
Contributor

@maxsmythe maxsmythe left a comment

Choose a reason for hiding this comment

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

LGTM

pkg/cachemanager/cachemanager.go Outdated Show resolved Hide resolved
break
case <-time.After(time.Second * 10):
log.Error(fmt.Errorf("internal: background relist did not exit gracefully"), "possible goroutine leak")
// do not close waitToCloseChan as the goroutine may eventually exit and call close on the channel
Copy link
Contributor

Choose a reason for hiding this comment

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

also, it will be GC'd anyway

Signed-off-by: alex <8968914+acpana@users.noreply.github.com>
waitToCloseChan := make(chan struct{})

// the 0th relist goroutine is stopped, by definition, so we close the channel.
close(waitToCloseChan)
Copy link
Member

Choose a reason for hiding this comment

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

Can you share why we are closing it right after it's created? I'm not clear on the comment.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

iirc, without closing the channel the first time around, the select block below will fire off an error (after 10 seconds hanging on a channel that is not signaled yet).

does that make sense? if so, how could we make the comment better?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@ritazh let me know if the updated comment address the why of not closing the relistStopChan here. 🙏🏼

Co-authored-by: Rita Zhang <rita.z.zhang@gmail.com>
Signed-off-by: alex <8968914+acpana@users.noreply.github.com>
@acpana acpana requested a review from ritazh September 12, 2023 17:04
Signed-off-by: alex <8968914+acpana@users.noreply.github.com>
Copy link
Member

@ritazh ritazh left a comment

Choose a reason for hiding this comment

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

LGTM

Thanks for addressing this!

@acpana acpana merged commit 2a50e1e into open-policy-agent:master Sep 18, 2023
15 checks passed
Mattes83 pushed a commit to Mattes83/gatekeeper that referenced this pull request Oct 25, 2023
Signed-off-by: Alex Pana <8968914+acpana@users.noreply.github.com>
Signed-off-by: alex <8968914+acpana@users.noreply.github.com>
Co-authored-by: Rita Zhang <rita.z.zhang@gmail.com>
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.

syncsets: improve replay
4 participants