mirror of
https://github.com/sourcegraph/sourcegraph.git
synced 2026-02-06 18:51:59 +00:00
Addresses https://github.com/sourcegraph/sourcegraph/issues/52420 Previously when App shut down it was leaving behind postgres processes thats caused issues due to the socket from the previous instance remaining. This is manifest to the user as a app with a blank screen that wouldn't launch. There were several issues 1. The github proxy was calling `os.Exit` on the first shutdown signal received. This is an issue for app because all services are running in the same parent process it would terminate the app before any other services or postgres could properly close. 2. Once the `os.Exit` issue was resolved the single binary would never terminate because it was paused on an empty select. This replaces the empty select with a 2nd wait group that waits for the termination of each service that was started. The app will exit now but leaves a race condition on shutdown of the services and postgres. 3. To resolve the race condition I removed postgres from being monitored as a background process and instead return a cleanup function from `Init` so that balance can be restored. Init is responsible for starting postgres before any service and now it can inform the caller how to clean up anything it needs to. |
||
|---|---|---|
| .. | ||
| BUILD.bazel | ||
| service.go | ||
| shared_test.go | ||
| shared.go | ||