mirror of
https://github.com/datarhei/core.git
synced 2025-10-06 16:37:04 +08:00
Change core shutdown sequence
Now the cluster, restreamer (processes), and the servers (HTTP, HTTP, RTMP, SRT) are shutdown first, then any other services. Before, e.g. the session collector was closed very early before the servers. This would have lead to loss of a few sessions.
This commit is contained in:
@@ -1734,20 +1734,6 @@ func (a *api) stop() {
|
|||||||
a.cluster.Shutdown()
|
a.cluster.Shutdown()
|
||||||
}
|
}
|
||||||
|
|
||||||
if a.iam != nil {
|
|
||||||
a.iam.Close()
|
|
||||||
}
|
|
||||||
|
|
||||||
if a.update != nil {
|
|
||||||
a.update.Stop()
|
|
||||||
a.update = nil
|
|
||||||
}
|
|
||||||
|
|
||||||
if a.service != nil {
|
|
||||||
a.service.Stop()
|
|
||||||
a.service = nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// Stop all restream processes
|
// Stop all restream processes
|
||||||
if a.restream != nil {
|
if a.restream != nil {
|
||||||
logger.Info().Log("Stopping all processes ...")
|
logger.Info().Log("Stopping all processes ...")
|
||||||
@@ -1755,38 +1741,6 @@ func (a *api) stop() {
|
|||||||
a.restream = nil
|
a.restream = nil
|
||||||
}
|
}
|
||||||
|
|
||||||
if a.process != nil {
|
|
||||||
a.process.Stop()
|
|
||||||
a.process = nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// Stop the session tracker
|
|
||||||
if a.sessions != nil {
|
|
||||||
a.sessions.UnregisterAll()
|
|
||||||
a.sessions.Close()
|
|
||||||
a.sessions = nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// Unregister all collectors
|
|
||||||
if a.metrics != nil {
|
|
||||||
a.metrics.UnregisterAll()
|
|
||||||
a.metrics = nil
|
|
||||||
}
|
|
||||||
|
|
||||||
if a.prom != nil {
|
|
||||||
a.prom.UnregisterAll()
|
|
||||||
a.prom = nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// Free the cached objects
|
|
||||||
if a.cache != nil {
|
|
||||||
a.cache.Purge()
|
|
||||||
a.cache = nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// Free the S3 mounts
|
|
||||||
a.s3fs = map[string]fs.Filesystem{}
|
|
||||||
|
|
||||||
// Stop the SRT server
|
// Stop the SRT server
|
||||||
if a.srtserver != nil {
|
if a.srtserver != nil {
|
||||||
a.log.logger.srt.Info().Log("Stopping ...")
|
a.log.logger.srt.Info().Log("Stopping ...")
|
||||||
@@ -1835,11 +1789,56 @@ func (a *api) stop() {
|
|||||||
a.sidecarserver = nil
|
a.sidecarserver = nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if a.iam != nil {
|
||||||
|
a.iam.Close()
|
||||||
|
}
|
||||||
|
|
||||||
|
if a.update != nil {
|
||||||
|
a.update.Stop()
|
||||||
|
a.update = nil
|
||||||
|
}
|
||||||
|
|
||||||
|
if a.service != nil {
|
||||||
|
a.service.Stop()
|
||||||
|
a.service = nil
|
||||||
|
}
|
||||||
|
|
||||||
|
if a.process != nil {
|
||||||
|
a.process.Stop()
|
||||||
|
a.process = nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// Unregister all collectors
|
||||||
|
if a.metrics != nil {
|
||||||
|
a.metrics.UnregisterAll()
|
||||||
|
a.metrics = nil
|
||||||
|
}
|
||||||
|
|
||||||
|
if a.prom != nil {
|
||||||
|
a.prom.UnregisterAll()
|
||||||
|
a.prom = nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// Free the cached objects
|
||||||
|
if a.cache != nil {
|
||||||
|
a.cache.Purge()
|
||||||
|
a.cache = nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// Free the S3 mounts
|
||||||
|
a.s3fs = map[string]fs.Filesystem{}
|
||||||
|
|
||||||
// Stop resource observer
|
// Stop resource observer
|
||||||
if a.resources != nil {
|
if a.resources != nil {
|
||||||
a.resources.Stop()
|
a.resources.Stop()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Stop the session tracker
|
||||||
|
if a.sessions != nil {
|
||||||
|
a.sessions.Close()
|
||||||
|
a.sessions = nil
|
||||||
|
}
|
||||||
|
|
||||||
// Stop the GC ticker
|
// Stop the GC ticker
|
||||||
if a.gcTickerStop != nil {
|
if a.gcTickerStop != nil {
|
||||||
a.gcTickerStop()
|
a.gcTickerStop()
|
||||||
|
Reference in New Issue
Block a user