Wait to write metrics
This commit is contained in:
parent
253017c429
commit
44b776ef32
@ -118,10 +118,13 @@ private func migrateMetric<T>(_ id: String, containing type: T.Type, in folder:
|
||||
// TODO: Write values back to disk
|
||||
let observer = MetricObserver(logFileFolder: folder, logMetricId: "sesame.migration")
|
||||
let metric: Metric<T> = observer.addMetric(id: id)
|
||||
private let semaphore = DispatchSemaphore(value: 0)
|
||||
Task {
|
||||
try await metric.update(all)
|
||||
print("Saved all values for metric \(id)")
|
||||
semaphore.signal()
|
||||
}
|
||||
semaphore.wait()
|
||||
print("Finished metric \(id)")
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user