Skip to content

Commit c1fa219

Browse files
ktosodrexin
authored andcommitted
=cluster shutdown: only .unbind if cluster was enabled
1 parent 8590f97 commit c1fa219

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

Sources/DistributedActors/ActorSystem.swift

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -237,13 +237,15 @@ public final class ActorSystem {
237237
/// Do not call from within actors or you may deadlock shutting down the system.
238238
public func shutdown() {
239239
self.log.log(level: .debug, "SHUTTING DOWN ACTOR SYSTEM [\(self.name)]. All actors will be stopped.", file: #file, function: #function, line: #line)
240-
let receptacle = BlockingReceptacle<Void>()
241-
self.cluster._shell.tell(.command(.unbind(receptacle))) // FIXME: should be shutdown
240+
if self.settings.cluster.enabled {
241+
let receptacle = BlockingReceptacle<Void>()
242+
self.cluster._shell.tell(.command(.unbind(receptacle))) // FIXME: should be shutdown
243+
receptacle.wait(atMost: .milliseconds(300)) // FIXME: configure
244+
}
242245
self.userProvider.stopAll()
243246
self.systemProvider.stopAll()
244247
self.dispatcher.shutdown()
245248
try! self.eventLoopGroup.syncShutdownGracefully()
246-
receptacle.wait(atMost: .milliseconds(100)) // FIXME: configure
247249
self.serialization = nil
248250
self._cluster = nil
249251
self._receptionist = self.deadLetters.adapted()

0 commit comments

Comments
 (0)