Skip to content

Implement safe recorder for improved concurrency in event streaming - #56

Merged
egasa21 merged 1 commit into
masterfrom
daily/ega
Jun 16, 2026
Merged

Implement safe recorder for improved concurrency in event streaming#56
egasa21 merged 1 commit into
masterfrom
daily/ega

Conversation

@egasa21

@egasa21 egasa21 commented Jun 16, 2026

Copy link
Copy Markdown
Contributor

This pull request refactors the test code for the deploy event streaming handler to improve thread safety and reliability. The main change is the introduction of a custom safeRecorder to replace the standard httptest.NewRecorder() in tests that involve concurrent writes, ensuring thread-safe access to the response body.

Test infrastructure improvements:

  • Introduced a thread-safe safeRecorder type to replace httptest.NewRecorder() in tests, preventing race conditions when accessing the response body during concurrent event streaming. (internal/server/handlers/deploy_test.go)
  • Updated all affected tests to use newSafeRecorder() instead of httptest.NewRecorder(). (internal/server/handlers/deploy_test.go) [1] [2] [3]
  • Replaced direct calls to rec.Body.String() with the new thread-safe method rec.BodyString(). (internal/server/handlers/deploy_test.go) [1] [2] [3]

Dependency updates:

  • Added "bytes" import to support the new recorder implementation. (internal/server/handlers/deploy_test.go)…ming tests

@egasa21
egasa21 merged commit 5976615 into master Jun 16, 2026
1 check passed
@egasa21
egasa21 deleted the daily/ega branch June 16, 2026 05:00
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