mirror of
https://github.com/Kong/go-pluginserver.git
synced 2025-09-27 04:26:20 +08:00
fix(*) handle closed channel to allow plugins to terminate processing (#16)
This commit is contained in:

committed by
Guilherme Salazar

parent
dec2701f43
commit
9dd9b0ffec
8
event.go
8
event.go
@@ -59,12 +59,16 @@ func (s *PluginServer) HandleEvent(in StartEventData, out *StepData) error {
|
||||
go func() {
|
||||
_ = <-ipc
|
||||
h(event.pdk)
|
||||
ipc <- "ret"
|
||||
|
||||
func() {
|
||||
defer func() { recover() }()
|
||||
ipc <- "ret"
|
||||
}()
|
||||
|
||||
s.lock.Lock()
|
||||
defer s.lock.Unlock()
|
||||
event.instance.lastEvent = time.Now()
|
||||
delete(s.events, event.id)
|
||||
s.lock.Unlock()
|
||||
}()
|
||||
|
||||
ipc <- "run" // kickstart the handler
|
||||
|
Reference in New Issue
Block a user