Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Alligning time options shinyproxy #459

Open
MohammadAliAmir opened this issue Sep 25, 2023 · 1 comment
Open

Alligning time options shinyproxy #459

MohammadAliAmir opened this issue Sep 25, 2023 · 1 comment

Comments

@MohammadAliAmir
Copy link

This is not an issue but more like an improvement.

When looking at the different options/parameters you can tweak corresponding to your needs, you can observe that the units used for time parameters are not alligned.

f.e.: heartbeat-timeout (in milliseconds), max-lifetime (in minutes). server.servlet.session.timeout (in seconds)
(from https://shinyproxy.io/documentation/configuration/)

When timeout behaviour of an app changes, the developer needs to adjust the value corresponding to which time parameter he is using. It would be more efficient to allign all units of time parameters so that:

  • changes can be applied more easily (no struggles of knowing which unit is used)
  • overview the time options (since same units are used)
@LEDfan
Copy link
Member

LEDfan commented Jan 2, 2024

Hi, thank you for raising this issue.

The difference in time unit for the different properties has two reasons:

  • some properties are native Spring properties and therefore we don't have control over the time unit these options are using.
  • depending on the use-case, some properties have less precision than other options. For example, ShinyProxy checks for timed-out proxies every 10 seconds (but this can be changed), while the max-lifetime of an app is only checked ever five minutes. Therefore, we decided to use minutes for the max-lifetime option, since if we would use seconds or milliseconds, a user could have the impression that it's checked more often and expect a difference in behavior when setting the options to e.g. 90 compared to 60 seconds.

That being said, I agree that it would be better to use a single time unit, I think that using seconds would be the best option, since ShinyProxy does not really take into account milliesconds (e.g. it never check timeouts more often than once a second). The problem is that I like to keep backwards compatibility and I'm afraid changing all properties to use seconds could cause a lot of issues and confusion for users.

I can think of two work-arounds:

Add s suffix to specify the value in seconds:

For example:

heartbeat-timeout: 10000 # current behavior, i.e. milliseconds,  would still work
heartbeat-timeout: 10s # optionally users can specify the option in seconds
max-lifetime: 5 # current behavior, i.e minutes
max-lifetime: 300s

Global option

The idea is that there is a global configuration option (disabled by default), that tells ShinyProxy to read every time-based option in seconds:

use-seconds: true
heartbeat-timeout: 10
max-lifetime: 300

Both solutions still has the caveat that we cannot easily change the time unit for Spring options, so it would be good if we also check whether you can configure a time-unit for Spring.

What do you think? If anyone in the community has feedback on this it would be welcome as well!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants