Skip to content

Commit

Permalink
Fix RxSwift synchronization warning on bootstrap (#295)
Browse files Browse the repository at this point in the history
  • Loading branch information
ivnsch authored Jun 30, 2020
1 parent 2c22c36 commit c73ac28
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion CoEpi/common/log/CachingLog.swift
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ class CachingLog: LogNonVariadicTags {
private let addLogTrigger: PublishSubject<LogMessage> = PublishSubject()
private let disposeBag = DisposeBag()

private let loggerSerialQueue = DispatchQueue(label: "org.coepi.logger")

init() {
addLogTrigger.withLatestFrom(logs, resultSelector: {(message, logs) in
(message, logs)
Expand Down Expand Up @@ -62,7 +64,9 @@ class CachingLog: LogNonVariadicTags {
}

private func log(_ message: LogMessage) {
addLogTrigger.onNext(message)
loggerSerialQueue.async { [weak self] in
self?.addLogTrigger.onNext(message)
}
}

private func addTag(tags: [LogTag], message: String) -> String {
Expand Down

0 comments on commit c73ac28

Please # to comment.