Skip to content

[v2] discovering if user is actually using code-server (for idle check - can do in v1) #1050

Closed
@antofthy

Description

@antofthy

Environment: A docker swarm running code-server development environments for multiple users simultaneously (teaching course).

Previously

code-server v1, will log to files in ".cache/code-server/logs" added
a line every time the users browser contacts the running code-server.
This happens at least every 5 minutes (on the dot), while the user has
a open browser pointing to "code-server".

This let me implement a check looking at when these log files last
updated to determine when the user last had a browser open to
code-server. This check could then shutdown the docker container
for users that have not used there code-server for some time.

That is we have implemented idle timeout for the docker instances.
This is vital for the system to keep things running smoothly for
the multi-user docker swarm.

So far I have found no equivalent to implement idle timeout in
code-server v2.

Suggestion.

Provide a 'heartbeat' option/file, that is 'touched' (does not have to
write anything but it could, just have the file timestamp updated),
whenever "code-server" is contacted by the users browser.

This will make idle checking a lot easier too as it not need to search
for the latest log file, just the one heartbeat file.

However a log file file (as in v1) will be fine too.

Or prehaps you have some other suggestion.

PS: Code-server v2 does generate logs whenever the user opens a file. The log is for it attempting to find a 'git' repository for the file, and failing.
But it is not really a good idle/in-use indicator.

Metadata

Metadata

Assignees

Labels

enhancementSome improvement that isn't a feature

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions