|
@@ -90,6 +90,9 @@ func (s *stdioHolder) StartStdout(notify_heartbeat func()) {
|
|
continue
|
|
continue
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ // update the last active time on each time the plugin sends data
|
|
|
|
+ s.lastActiveAt = time.Now()
|
|
|
|
+
|
|
plugin_entities.ParsePluginUniversalEvent(
|
|
plugin_entities.ParsePluginUniversalEvent(
|
|
data,
|
|
data,
|
|
"",
|
|
"",
|
|
@@ -106,7 +109,6 @@ func (s *stdioHolder) StartStdout(notify_heartbeat func()) {
|
|
}
|
|
}
|
|
},
|
|
},
|
|
func() {
|
|
func() {
|
|
- s.lastActiveAt = time.Now()
|
|
|
|
// notify launched
|
|
// notify launched
|
|
notify_heartbeat()
|
|
notify_heartbeat()
|
|
},
|
|
},
|
|
@@ -185,9 +187,20 @@ func (s *stdioHolder) Wait() error {
|
|
select {
|
|
select {
|
|
case <-ticker.C:
|
|
case <-ticker.C:
|
|
// check heartbeat
|
|
// check heartbeat
|
|
- if time.Since(s.lastActiveAt) > 60*time.Second {
|
|
|
|
|
|
+ if time.Since(s.lastActiveAt) > 120*time.Second {
|
|
|
|
+ log.Error(
|
|
|
|
+ "plugin %s is not active for 120 seconds, it may be dead, killing and restarting it",
|
|
|
|
+ s.pluginUniqueIdentifier,
|
|
|
|
+ )
|
|
return plugin_errors.ErrPluginNotActive
|
|
return plugin_errors.ErrPluginNotActive
|
|
}
|
|
}
|
|
|
|
+ if time.Since(s.lastActiveAt) > 60*time.Second {
|
|
|
|
+ log.Warn(
|
|
|
|
+ "plugin %s is not active for %d seconds, it may be dead",
|
|
|
|
+ s.pluginUniqueIdentifier,
|
|
|
|
+ time.Since(s.lastActiveAt).Seconds(),
|
|
|
|
+ )
|
|
|
|
+ }
|
|
case <-s.waitingControllerChan:
|
|
case <-s.waitingControllerChan:
|
|
// closed
|
|
// closed
|
|
return s.Error()
|
|
return s.Error()
|