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

luci-mod-status: use raw dsl values and format them ourselves #4635

Merged
merged 1 commit into from Dec 4, 2020

Conversation

dhewg
Copy link
Contributor

@dhewg dhewg commented Dec 4, 2020

Currently lantiq_dsl.sh performs these formats expensively in a shell
script. Use the raw values so the preformatted onces can be removed to
cut down the runtime or the script.

Signed-off-by: Andre Heider a.heider@gmail.com

if (s > 0)
return '%ds'.format(seconds);
return null;
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you can simply use the %t format here to shrink the code.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

if (bytes > 1000)
return '%.3f Kb/s'.format(bytes / 1000);
return '%d b/s'.format(bytes);
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That entire function could be replaced by '%1000.3mb/s'.format(bytes)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

Currently lantiq_dsl.sh performs these formats expensively in a shell
script. Use the raw values so the preformatted onces can be removed to
cut down the runtime or the script.

Signed-off-by: Andre Heider <a.heider@gmail.com>
@dhewg
Copy link
Contributor Author

dhewg commented Dec 4, 2020

Thanks, that's much more simple (first time hacking on luci and js)

@jow- jow- merged commit b6c8444 into openwrt:master Dec 4, 2020
@jow-
Copy link
Contributor

jow- commented Dec 4, 2020

Merged, thanks!

@dhewg dhewg deleted the dsl branch December 4, 2020 12:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants