Skip to content

Commit d7b248e

Browse files
committed
Allow re-using existing DA instances
1 parent 5cbec25 commit d7b248e

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

Sources/WebWorkerKit/WebWorkerActorSystem.swift

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,12 @@ final public class WebWorkerActorSystem: DistributedActorSystem, Sendable {
111111
return actor
112112
}
113113

114+
if childWorkers[id] != nil {
115+
// We already have a child worker for this ID
116+
// We can continue to use it as we did before
117+
return nil
118+
}
119+
114120
let (scriptPath, isModule) = getScriptDetails(for: Act.self)
115121

116122
let childWorker = try WebWorkerHost(scriptPath: scriptPath, isModule: isModule)

0 commit comments

Comments
 (0)