Add debug logs around exiting goroutines

I'm debugging our clean shutdown
This commit is contained in:
Eli Ribble 2026-04-21 19:37:58 +00:00
parent 4a214b099e
commit 0b005c3e76
No known key found for this signature in database
3 changed files with 7 additions and 1 deletions

View file

@ -136,9 +136,10 @@ func refreshFieldseekerData(background_ctx context.Context, newOauthCh <-chan st
select { select {
case <-ctx.Done(): case <-ctx.Done():
log.Info().Msg("Exiting refresh worker...") log.Debug().Msg("Exiting arcgis refresh worker...")
cancel() cancel()
wg.Wait() wg.Wait()
log.Debug().Msg("arcgis refresh worker exited.")
return return
case <-newOauthCh: case <-newOauthCh:
log.Info().Msg("Updating oauth background work") log.Info().Msg("Updating oauth background work")

View file

@ -58,11 +58,13 @@ func StartAll(ctx context.Context) error {
go func() { go func() {
defer waitGroup.Done() defer waitGroup.Done()
refreshFieldseekerData(ctx, newOAuthTokenChannel) refreshFieldseekerData(ctx, newOAuthTokenChannel)
log.Debug().Msg("Exiting Fieldseeker refresh goroutine")
}() }()
waitGroup.Add(1) waitGroup.Add(1)
go func() { go func() {
defer waitGroup.Done() defer waitGroup.Done()
listenForJobs(ctx) listenForJobs(ctx)
log.Debug().Msg("Exiting job listener goroutine")
}() }()
err = addWaitingJobs(ctx) err = addWaitingJobs(ctx)
@ -136,6 +138,7 @@ func listenForJobs(ctx context.Context) {
select { select {
case <-ctx.Done(): case <-ctx.Done():
log.Debug().Msg("Exiting listenForJobs")
return return
default: default:
// If listenAndSendOneConn returned and ctx has not been cancelled that means there was a fatal database error. // If listenAndSendOneConn returned and ctx has not been cancelled that means there was a fatal database error.

View file

@ -61,6 +61,7 @@ export const SSEManager: SSEManagerType = (function (): SSEManagerType {
// Reconnect after delay // Reconnect after delay
setTimeout(() => { setTimeout(() => {
console.log("SSE reconnecting");
connectionPromise = null; connectionPromise = null;
connect(url); connect(url);
}, 5000); }, 5000);
@ -80,6 +81,7 @@ export const SSEManager: SSEManagerType = (function (): SSEManagerType {
eventSource = null; eventSource = null;
isConnected = false; isConnected = false;
connectionPromise = null; connectionPromise = null;
console.log("SSE disconnected");
} }
} }