viiccwen commented on code in PR #69923:
URL: https://github.com/apache/airflow/pull/69923#discussion_r3613117045
##########
go-sdk/edge/worker.go:
##########
@@ -291,13 +296,12 @@ func (w *worker) mainLoop(ctx context.Context) error {
select {
case sig := <-sigChan:
switch sig {
- case os.Interrupt:
+ case os.Interrupt, syscall.SIGTERM:
if !w.drain {
w.logger.Info(
- "Draining worker of running
tasks before stopping, hit ^C again to force terminate",
+ "Draining worker of running
tasks before stopping; send another termination signal to force terminate",
)
w.drain = true
- w.heartbeat(ctx)
Review Comment:
Hello @jason810496, thx for raising this!
The heartbeat was removed intentionally. It's synchronous and uses the
main-loop context, so an unavailable or stalled Edge API **can block** the
first SIGTERM handler. That delays stopFetchJobs() and prevents the loop from
receiving a second SIGTERM to force termination, potentially exhausting the
container shutdown grace period.
The worker still reports Offline through deregister, which uses its own
bounded timeout. The added test verifies that the first SIGTERM starts draining
without issuing this blocking heartbeat.
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]