langserver: Use docker events instead of aggressive polling
Created by: keegancsmith
Previously we would poll every second every docker container to find out the
status. This lead to a surprisingly high amount of resource usage. Instead we
can use docker events
to be notified when a container state changes.
We don't parse the docker events output, instead when an event happens we recheck all state. This does mean that if a docker daemon has a constantly changing state on a container it will trigger often. As such we also never consume from the event channel faster than 1 event per second.
Supersedes https://github.com/sourcegraph/sourcegraph/pull/388
Fixes https://github.com/sourcegraph/enterprise/issues/13646