Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix example app #171

Merged
merged 1 commit into from
Nov 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -75,13 +75,14 @@ class DocumentViewController: UIViewController {
let semaphore = self.semaphore
let treeAccessor = self.treeAccessor
let path = self.path
var fileReader = self.fileReader

task = Task {
await server.appendRoute("*") { (request) in
await server.appendRoute("*") { [weak self] (request) in
await semaphore.wait()
defer { Task { await semaphore.signal() } }

guard let self else { return HTTPResponse(statusCode: .internalServerError) }

if fileReader == nil {
fileReader = try await treeAccessor.fileReader(path: path)
}
Expand Down Expand Up @@ -136,7 +137,7 @@ class DocumentViewController: UIViewController {
)
}

try await server.start()
try await server.run()
}

Task { @MainActor in
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,14 @@ class DocumentWindowController: NSWindowController, NSWindowDelegate {
let semaphore = self.semaphore
let treeAccessor = self.treeAccessor
let path = self.path
var fileReader = self.fileReader

task = Task {
await server.appendRoute("*") { (request) in
await server.appendRoute("*") { [weak self] (request) in
await semaphore.wait()
defer { Task { await semaphore.signal() } }

guard let self else { return HTTPResponse(statusCode: .internalServerError) }

if fileReader == nil {
fileReader = try await treeAccessor.fileReader(path: path)
}
Expand Down
Loading