INNER CODE UNIT · Go

timeoutChannel

nicholas-fedor/watchtower · cmd/notify-upgrade.go:199

	timeoutChannel := make(chan struct{}, 1) // Buffer 1 to avoid blocking

	// Trigger cleanup after timeout
	time.AfterFunc(cleanupTimeout, func() {
		timeoutChannel <- struct{}{}
	})

	// Notify on interrupts
	signal.Notify(signalChannel, os.Interrupt, syscall.SIGTERM)

	// Wait for a signal and perform cleanup.
	select {
	case <-timeoutChannel:
		log.Info().Msg("Timed out")
	case sig := <-signalChannel:
		log.Info().
			Str("signal", sig.String()).
			Msg("Stopping")

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…