From fa178d7c26da611e806d7c73e3b4424595ecf392 Mon Sep 17 00:00:00 2001 From: Sergey Date: Wed, 21 Jun 2023 13:50:50 +0500 Subject: [PATCH] Add app.IterateComponents method. This method helps to create debugging HTTP handlers in Heart --- app/app.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/app/app.go b/app/app.go index 21f2f52c..2295cdbf 100644 --- a/app/app.go +++ b/app/app.go @@ -262,6 +262,14 @@ func (app *App) Start(ctx context.Context) (err error) { 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 { buf := make([]byte, 1024) for {