Skip to content

Commit

Permalink
Allow re-using existing DA instances
Browse files Browse the repository at this point in the history
  • Loading branch information
ephemer committed Nov 21, 2022
1 parent 5cbec25 commit d7b248e
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions Sources/WebWorkerKit/WebWorkerActorSystem.swift
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,12 @@ final public class WebWorkerActorSystem: DistributedActorSystem, Sendable {
return actor
}

if childWorkers[id] != nil {
// We already have a child worker for this ID
// We can continue to use it as we did before
return nil
}

let (scriptPath, isModule) = getScriptDetails(for: Act.self)

let childWorker = try WebWorkerHost(scriptPath: scriptPath, isModule: isModule)
Expand Down

0 comments on commit d7b248e

Please sign in to comment.