wolfstudy commented on a change in pull request #6031: [Issue 4175] [pulsar-function-go] Add Go Function heartbeat (and gRPC service) for production usage URL: https://github.com/apache/pulsar/pull/6031#discussion_r366944885
########## File path: pulsar-function-go/pf/instance.go ########## @@ -35,19 +36,57 @@ type goInstance struct { producer pulsar.Producer consumers map[string]pulsar.Consumer client pulsar.Client + lastHealthCheckTs int64 } + // newGoInstance init goInstance and init function context func newGoInstance() *goInstance { goInstance := &goInstance{ context: NewFuncContext(), consumers: make(map[string]pulsar.Consumer), } + now := time.Now() + goInstance.lastHealthCheckTs = now.UnixNano() return goInstance } +func (gi *goInstance) processSpawnerHealthCheckTimer(tkr *time.Ticker){ + log.Info("Starting processSpawnerHealthCheckTimer") + now := time.Now() + maxIdleTime := gi.context.GetMaxIdleTime() + timeSinceLastCheck := now.UnixNano() - gi.lastHealthCheckTs + if (timeSinceLastCheck) > (maxIdleTime) { + log.Errorf("Haven't received health check from spawner in a while. Stopping instance...") Review comment: ```suggestion log.Error("Haven't received health check from spawner in a while. Stopping instance...") ``` ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services