Description
Although we have a background ssh config that Jetbrains Gateway uses for admin actions, it will also open multiple connections under the primary hostname which reports activity while the connection is open. Because clients like Jetbrains Gateway will open multiple of these connections for a single IDE session, we need to debounce the updates coming in from these multiple connections on the coder server so that we report this activity as just 1 jetbrains ssh session and not 2+.
It's possible that this is a Jetbrains Gateway bug and related to #179 - If the first connection sees an error and Jetbrains opens another connection (and leaves the old one open) you could see 2 ssh commands running when jetbrains is only using 1.
After opening the IDE you can see the following:
ps aux | grep -e "--usage-app="
f0ssel 28578 1.2 0.2 409780816 41840 ?? S 3:25PM 0:00.46 /Users/f0ssel/Library/Application Support/coder-gateway/localhost-3000/coder-darwin-arm64 --global-config /Users/f0ssel/Library/Application Support/coder-gateway/localhost-3000/config --url http://localhost:3000 ssh --stdio --disable-autostart --usage-app=jetbrains admin/jetbrains1.main
f0ssel 28502 0.7 0.2 409790336 37376 ?? S 3:25PM 0:00.45 /Users/f0ssel/Library/Application Support/coder-gateway/localhost-3000/coder-darwin-arm64 --global-config /Users/f0ssel/Library/Application Support/coder-gateway/localhost-3000/config --url http://localhost:3000 ssh --stdio --disable-autostart --usage-app=disable admin/jetbrains1.main
f0ssel 28595 0.6 0.2 409788496 40704 ?? S 3:25PM 0:00.21 /Users/f0ssel/Library/Application Support/coder-gateway/localhost-3000/coder-darwin-arm64 --global-config /Users/f0ssel/Library/Application Support/coder-gateway/localhost-3000/config --url http://localhost:3000 ssh --stdio --disable-autostart --usage-app=jetbrains admin/jetbrains1.main
f0ssel 28517 0.4 0.2 409780304 36384 ?? S 3:25PM 0:00.31 /Users/f0ssel/Library/Application Support/coder-gateway/localhost-3000/coder-darwin-arm64 --global-config /Users/f0ssel/Library/Application Support/coder-gateway/localhost-3000/config --url http://localhost:3000 ssh --stdio --disable-autostart --usage-app=disable admin/jetbrains1.main
f0ssel 28695 0.0 0.0 408626896 1408 s001 S+ 3:25PM 0:00.00 grep --color=auto --exclude-dir=.bzr --exclude-dir=CVS --exclude-dir=.git --exclude-dir=.hg --exclude-dir=.svn --exclude-dir=.idea --exclude-dir=.tox -e --usage-app=