|
guard let bytes = FileManager.default.contents(atPath: path) else { |
The public func reload() throws is clearly not right, it needs to be public func reload() async throws because we cannot guarantee that the file I/O is synchronous. In fact in the places where this is useful, it's quite likely that the orchestrator is using a virtualised networked filesystem which is very much not synchronous.
The whole implementation needs to be vetted for Foundation usage which does blocking I/O. If (for the time being whilst NIOFileSystem is still _NIOFileSystem) we need a temporary solution, then the blocking calls need to absolutely be offloaded to a NIOThreadPool` to be guaranteed not to run on the EventLoops or the Swift Concurrency threads
swift-nio-extras/Sources/NIOCertificateReloading/TimedCertificateReloader.swift
Line 564 in b87fdbf
The
public func reload() throwsis clearly not right, it needs to bepublic func reload() async throwsbecause we cannot guarantee that the file I/O is synchronous. In fact in the places where this is useful, it's quite likely that the orchestrator is using a virtualised networked filesystem which is very much not synchronous.The whole implementation needs to be vetted for
Foundationusage which does blocking I/O. If (for the time being whilst NIOFileSystem is still_NIOFileSystem) we need a temporary solution, then the blocking calls need to absolutely be offloaded to aNIOThreadPool` to be guaranteed not to run on the EventLoops or the Swift Concurrency threads