Skip to content

Commit f8b2270

Browse files
Merge pull request #3736 from SwiftPackageIndex/fix-AppMetrix-bootstrap
Fix AppMetrics.bootstrap
2 parents bc975ca + 3d9029a commit f8b2270

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

Sources/App/Core/AppMetrics.swift

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,11 @@ enum AppMetrics {
2626
static func bootstrap() {
2727
// prevent tests from boostrapping multiple times
2828
guard !initialized.withLock({ $0 }) else { return }
29-
defer { initialized.withLock{ $0 = true } }
30-
let client = PrometheusClient()
31-
MetricsSystem.bootstrap(PrometheusMetricsFactory(client: client))
29+
initialized.withLock {
30+
let client = PrometheusClient()
31+
MetricsSystem.bootstrap(PrometheusMetricsFactory(client: client))
32+
$0 = true
33+
}
3234
}
3335

3436
// metrics

0 commit comments

Comments
 (0)