当前位置:网站首页>The kernel fails to shut down when the easygbs program stops. How should I optimize it? [code attached]

The kernel fails to shut down when the easygbs program stops. How should I optimize it? [code attached]

2022-06-23 08:11:00 Tsingsee green rhino video

last year TSINGSEE Green rhino video EasyDSS、EasyGBS And other video platforms have been replaced with new kernel versions . The performance of the new kernel version is more stable , Interested users can go to the official website for use experience .

Recently, we received feedback from users , In the test EasyGBS In the process of , Sometimes in Linux Under the system ,EasyGBS Although closed , But the kernel didn't shut down . In this case , We optimized the code .

because EasyGBS The program runs as a service , stay Linux System below systemd The way the daemon implements the service . This is the case , We guess it is due to the slow closing of the upper layer , The time is too long to close the kernel program started at the bottom . So we need to optimize the code , stay EasyGBS When the program closes , Stop the kernel program immediately , To ensure the normal exit of the program .

The code is as follows :

func (p *program) Stop(s service.Service) (err error) {
   defer log.Println("********** STOP **********")
   defer utils.CloseLogWriter()
   redis2.Close()
   stund.Close()
   mediaserver2.UnInit()
   p.StopHTTP()
   sms.UnInit()
   uas.Stop()
   stream.CloseClient()
   gbsdao.Close() // Close database links 
   nvs.Stop()
   return
}

The purpose of the above procedure is ,EasyGBS After receiving the stop command , First close redis, Then close the hole drilling service stund, Then shut down the kernel mediaserver, Finally, close other modules on the upper layer , In this way, the program can be closed normally .

After optimization, submit it to the user for testing , There is no case that the above kernel is not shut down .

EasyGBS The national standard video cloud service platform developed many functions last year , Such as alarm function 、 Voice intercom function, etc . This year, we will continue to test the adaptability of these functions , At present, we are also developing some intelligent analysis related services , If you are interested, you can follow our blog , We will share our development experience in our blog from time to time .

原网站

版权声明
本文为[Tsingsee green rhino video]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/01/202201121854510698.html