-
Notifications
You must be signed in to change notification settings - Fork 487
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix issue with unnecessary config reload in static mode (#6977)
* Fix issue with unnecessary config reload * Update changelog * Simplify byte slice to string conversion * Avoid race conditions when checking logs in tests
- Loading branch information
Showing
9 changed files
with
317 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package util | ||
|
||
import ( | ||
"bytes" | ||
"sync" | ||
) | ||
|
||
// SyncBuffer wraps around a bytes.Buffer and makes it safe to use from | ||
// multiple goroutines. | ||
type SyncBuffer struct { | ||
mut sync.RWMutex | ||
buf bytes.Buffer | ||
} | ||
|
||
func (sb *SyncBuffer) Bytes() []byte { | ||
sb.mut.RLock() | ||
defer sb.mut.RUnlock() | ||
|
||
return sb.buf.Bytes() | ||
} | ||
|
||
func (sb *SyncBuffer) String() string { | ||
sb.mut.RLock() | ||
defer sb.mut.RUnlock() | ||
|
||
return sb.buf.String() | ||
} | ||
|
||
func (sb *SyncBuffer) Write(p []byte) (n int, err error) { | ||
sb.mut.Lock() | ||
defer sb.mut.Unlock() | ||
|
||
return sb.buf.Write(p) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.