Close Lua plugins on reload
This commit is contained in:
parent
171da51289
commit
b014c1898f
1 changed files with 11 additions and 2 deletions
13
server.go
13
server.go
|
@ -18,8 +18,9 @@ type Server struct {
|
|||
e *echo.Echo
|
||||
Sessions *SessionManager
|
||||
|
||||
mutex sync.RWMutex // used for server reload
|
||||
plugins []Plugin
|
||||
mutex sync.RWMutex // used for server reload
|
||||
plugins []Plugin
|
||||
luaPlugins []Plugin
|
||||
|
||||
imap struct {
|
||||
host string
|
||||
|
@ -98,7 +99,15 @@ func (s *Server) load() error {
|
|||
s.mutex.Lock()
|
||||
defer s.mutex.Unlock()
|
||||
|
||||
// Close previous Lua plugins
|
||||
for _, p := range s.luaPlugins {
|
||||
if err := p.Close(); err != nil {
|
||||
s.e.Logger.Printf("Failed to unload plugin '%v': %v", p.Name(), err)
|
||||
}
|
||||
}
|
||||
|
||||
s.plugins = plugins
|
||||
s.luaPlugins = luaPlugins
|
||||
s.e.Renderer = renderer
|
||||
|
||||
for _, p := range plugins {
|
||||
|
|
Loading…
Reference in a new issue