Add app.IterateComponents method. This method helps to create debugging HTTP handlers in Heart

This commit is contained in:
Sergey 2023-06-21 13:50:50 +05:00
parent ff3fc68451
commit fa178d7c26
No known key found for this signature in database
GPG Key ID: 3B6BEF79160221C6

View File

@ -262,6 +262,14 @@ func (app *App) Start(ctx context.Context) (err error) {
return return
} }
func (app *App) IterateComponents(fn func(Component)) {
app.mu.RLock()
defer app.mu.RUnlock()
for _, s := range app.components {
fn(s)
}
}
func stackAllGoroutines() []byte { func stackAllGoroutines() []byte {
buf := make([]byte, 1024) buf := make([]byte, 1024)
for { for {