Skip to content

fix: implement Flush on trackingResponseWriter#34

Open
pinginfo wants to merge 1 commit into
pgsty:masterfrom
pinginfo:fix-api-listenbucketnotification
Open

fix: implement Flush on trackingResponseWriter#34
pinginfo wants to merge 1 commit into
pgsty:masterfrom
pinginfo:fix-api-listenbucketnotification

Conversation

@pinginfo
Copy link
Copy Markdown

@pinginfo pinginfo commented May 2, 2026

Community Contribution License

All community contributions in this pull request are licensed to the project maintainers
under the terms of the Apache 2 license.
By creating this pull request I represent that I have the right to license the
contributions to the project maintainers under the Apache 2 license.

Description

Add http.Flusher interface implementation to trackingReponseWriter so that streaming handlers like ListenBucketNotification continue to work when the double-response guard is active.

Commit 52eee5a introduced trackingReponseWrite to prevent double HTTP responses on a single request. However trackingReponseWriter did not implement the http.Flusher interface. This caused xhttp.Flush(w) which uses a type assertion w.(http.Flushed) to become a no-op when the wrapper was active. As a result, streaming handlers like ListenBucketNotification (used by mcli watch) would buffer event data indefinitely without ever flushing it to the client, making the notification listener appear broken.

Motivation and Context

ListenBucketNotification uses a long-lived HTTP connection with Server-Sent Events. After writing each event, it calls xhttp.flush(w) to immediately push data to the client. Without http.Flusher on trackingResponseWriter, the flush was silently skipped, and events never reached the client.

How to test this PR?

  1. Start a MinIO server
  2. Run mcli watch myminio/bucket
  3. Push file to the bucket
  4. You should receive events

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Optimization (provides speedup with no functional changes)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • Fixes a regression (52eee5a)
  • Unit tests added/updated
  • Internal documentation updated
  • Create a documentation update request here

Allows the trackingResponseWriter to properly proxy flush
requests to the underlying http.Flusher. This ensures
compatibility with streaming responses.
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