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

Empty log queue on flush and close #19994

Merged
merged 5 commits into from
Jun 18, 2022

Conversation

zeripath
Copy link
Contributor

It is possible for log events to remain in the buffer off the multichannelledlog
and thus not be logged despite close or flush.

This PR simply adds a function to empty the queue before closing or flushing.
(Except when the logger is paused.)

Reference #19982

Signed-off-by: Andrew Thornton art27@cantab.net

It is possible for log events to remain in the buffer off the multichannelledlog
and thus not be logged despite close or flush.

This PR simply adds a function to empty the queue before closing or flushing.
(Except when the logger is paused.)

Reference go-gitea#19982

Signed-off-by: Andrew Thornton <art27@cantab.net>
@zeripath zeripath added the type/enhancement An improvement of existing functionality label Jun 17, 2022
@zeripath zeripath added this to the 1.17.0 milestone Jun 17, 2022
@GiteaBot GiteaBot added the lgtm/need 1 This PR needs approval from one additional maintainer to be merged. label Jun 17, 2022
@wxiaoguang
Copy link
Contributor

IIRC, there is also a ChannelledLog, which uses similar logic.

@zeripath
Copy link
Contributor Author

IIRC, there is also a ChannelledLog, which uses similar logic.

Good catch - I'd forgotten that was the structure.

}
m.rwmutex.RLock()
for _, logger := range m.loggers {
err := logger.LogEvent(event)
Copy link
Member

Choose a reason for hiding this comment

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

Why does this one throw an error and the other doesn't?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That's the API that was there originally.

@GiteaBot GiteaBot added lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. and removed lgtm/need 1 This PR needs approval from one additional maintainer to be merged. labels Jun 18, 2022
@lunny
Copy link
Member

lunny commented Jun 18, 2022

make L-G-T-M work.

@lunny lunny merged commit 8eefe2a into go-gitea:main Jun 18, 2022
@zeripath zeripath deleted the empty-log-queue-on-flush-and-close branch June 18, 2022 06:59
zjjhot added a commit to zjjhot/gitea that referenced this pull request Jun 20, 2022
* giteaofficial/release/v1.17: (35 commits)
  Simplify and fix migration 216 (go-gitea#20036)
  Alter hook_task TEXT fields to LONGTEXT (go-gitea#20038) (go-gitea#20041)
  Backtick table name in generic orphan check (go-gitea#20019) (go-gitea#20037)
  Respond with a 401 on git push when password isn't changed yet (go-gitea#20027)
  Fix delete pull head ref for DeleteIssue (go-gitea#20032)  (go-gitea#20034)
  use quoted regexp instead of git fixed-value (go-gitea#20030)
  Dump should only copy regular files and symlink regular files (go-gitea#20015) (go-gitea#20021)
  Return 404 when tag is broken (go-gitea#20024)
  [skip ci] Updated translations via Crowdin
  [skip ci] Updated translations via Crowdin
  Add fgprof pprof profiler (go-gitea#20005)
  [skip ci] Updated translations via Crowdin
  Improve action table indices (go-gitea#19472)
  Add dbconsistency checks for Stopwatches (go-gitea#20010)
  fix push mirrors URL are no longer displayed on the UI (go-gitea#20011)
  Empty log queue on flush and close (go-gitea#19994)
  [skip ci] Updated translations via Crowdin
  Stop spurious APIFormat stopwatches logs (go-gitea#20008)
  Fix CountOrphanedLabels in orphan check (go-gitea#20009)
  Write Commit-Graphs in RepositoryDumper (go-gitea#20004)
  ...
vsysoev pushed a commit to IntegraSDL/gitea that referenced this pull request Aug 10, 2022
* Empty log queue on flush and close

It is possible for log events to remain in the buffer off the multichannelledlog
and thus not be logged despite close or flush.

This PR simply adds a function to empty the queue before closing or flushing.
(Except when the logger is paused.)

Reference go-gitea#19982

Signed-off-by: Andrew Thornton <art27@cantab.net>

* and do similar for ChannelledLog

Signed-off-by: Andrew Thornton <art27@cantab.net>

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
AbdulrhmnGhanem pushed a commit to kitspace/gitea that referenced this pull request Aug 24, 2022
* Empty log queue on flush and close

It is possible for log events to remain in the buffer off the multichannelledlog
and thus not be logged despite close or flush.

This PR simply adds a function to empty the queue before closing or flushing.
(Except when the logger is paused.)

Reference go-gitea#19982

Signed-off-by: Andrew Thornton <art27@cantab.net>

* and do similar for ChannelledLog

Signed-off-by: Andrew Thornton <art27@cantab.net>

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
@go-gitea go-gitea locked and limited conversation to collaborators May 3, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. type/enhancement An improvement of existing functionality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants