mirror of https://github.com/jetkvm/kvm.git
Compare commits
4 Commits
45b72b2a73
...
5be057c387
| Author | SHA1 | Date |
|---|---|---|
|
|
5be057c387 | |
|
|
79098d3546 | |
|
|
50fc88aae1 | |
|
|
0baf6be8b5 |
|
|
@ -69,3 +69,23 @@ jobs:
|
||||||
path: |
|
path: |
|
||||||
bin/jetkvm_app
|
bin/jetkvm_app
|
||||||
device-tests.tar.gz
|
device-tests.tar.gz
|
||||||
|
release:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
name: Release
|
||||||
|
needs: build
|
||||||
|
if: startsWith(github.ref, 'refs/tags/')
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
- name: Download artifacts
|
||||||
|
uses: actions/download-artifact@v4
|
||||||
|
- name: Draft release
|
||||||
|
uses: softprops/action-gh-release@v2
|
||||||
|
with:
|
||||||
|
# need review before making a real release
|
||||||
|
draft: true
|
||||||
|
files: bin/jetkvm_app
|
||||||
|
fail_on_unmatched_files: true
|
||||||
|
tag_name: ${{ github.ref }}
|
||||||
|
name: ${{ github.ref }}
|
||||||
|
generate_release_notes: true
|
||||||
|
|
@ -305,11 +305,11 @@ func wakeDisplay(force bool, reason string) {
|
||||||
displayLogger.Warn().Err(err).Msg("failed to wake display")
|
displayLogger.Warn().Err(err).Msg("failed to wake display")
|
||||||
}
|
}
|
||||||
|
|
||||||
if config.DisplayDimAfterSec != 0 {
|
if config.DisplayDimAfterSec != 0 && dimTicker != nil {
|
||||||
dimTicker.Reset(time.Duration(config.DisplayDimAfterSec) * time.Second)
|
dimTicker.Reset(time.Duration(config.DisplayDimAfterSec) * time.Second)
|
||||||
}
|
}
|
||||||
|
|
||||||
if config.DisplayOffAfterSec != 0 {
|
if config.DisplayOffAfterSec != 0 && offTicker != nil {
|
||||||
offTicker.Reset(time.Duration(config.DisplayOffAfterSec) * time.Second)
|
offTicker.Reset(time.Duration(config.DisplayOffAfterSec) * time.Second)
|
||||||
}
|
}
|
||||||
backlightState = 0
|
backlightState = 0
|
||||||
|
|
|
||||||
|
|
@ -111,6 +111,7 @@ type Client struct {
|
||||||
var (
|
var (
|
||||||
defaultTimerDuration = 1 * time.Second
|
defaultTimerDuration = 1 * time.Second
|
||||||
defaultLinkUpTimeout = 30 * time.Second
|
defaultLinkUpTimeout = 30 * time.Second
|
||||||
|
defaultDHCPTimeout = 5 * time.Second // DHCP request timeout (not link up timeout)
|
||||||
maxRenewalAttemptDuration = 2 * time.Hour
|
maxRenewalAttemptDuration = 2 * time.Hour
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
@ -125,11 +126,11 @@ func NewClient(ctx context.Context, ifaces []string, c *Config, l *zerolog.Logge
|
||||||
}
|
}
|
||||||
|
|
||||||
if cfg.Timeout == 0 {
|
if cfg.Timeout == 0 {
|
||||||
cfg.Timeout = defaultLinkUpTimeout
|
cfg.Timeout = defaultDHCPTimeout
|
||||||
}
|
}
|
||||||
|
|
||||||
if cfg.Retries == 0 {
|
if cfg.Retries == 0 {
|
||||||
cfg.Retries = 3
|
cfg.Retries = 4
|
||||||
}
|
}
|
||||||
|
|
||||||
return &Client{
|
return &Client{
|
||||||
|
|
@ -153,9 +154,15 @@ func NewClient(ctx context.Context, ifaces []string, c *Config, l *zerolog.Logge
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func resetTimer(t *time.Timer, l *zerolog.Logger) {
|
func resetTimer(t *time.Timer, attempt int, l *zerolog.Logger) {
|
||||||
l.Debug().Dur("delay", defaultTimerDuration).Msg("will retry later")
|
// Exponential backoff: 1s, 2s, 4s, 8s, max 8s
|
||||||
t.Reset(defaultTimerDuration)
|
backoffAttempt := attempt
|
||||||
|
if backoffAttempt > 3 {
|
||||||
|
backoffAttempt = 3
|
||||||
|
}
|
||||||
|
delay := time.Duration(1<<backoffAttempt) * time.Second
|
||||||
|
l.Debug().Dur("delay", delay).Int("attempt", attempt).Msg("will retry later")
|
||||||
|
t.Reset(delay)
|
||||||
}
|
}
|
||||||
|
|
||||||
func getRenewalTime(lease *Lease) time.Duration {
|
func getRenewalTime(lease *Lease) time.Duration {
|
||||||
|
|
@ -168,12 +175,14 @@ func getRenewalTime(lease *Lease) time.Duration {
|
||||||
|
|
||||||
func (c *Client) requestLoop(t *time.Timer, family int, ifname string) {
|
func (c *Client) requestLoop(t *time.Timer, family int, ifname string) {
|
||||||
l := c.l.With().Str("interface", ifname).Int("family", family).Logger()
|
l := c.l.With().Str("interface", ifname).Int("family", family).Logger()
|
||||||
|
attempt := 0
|
||||||
for range t.C {
|
for range t.C {
|
||||||
l.Info().Msg("requesting lease")
|
l.Info().Int("attempt", attempt).Msg("requesting lease")
|
||||||
|
|
||||||
if _, err := c.ensureInterfaceUp(ifname); err != nil {
|
if _, err := c.ensureInterfaceUp(ifname); err != nil {
|
||||||
l.Error().Err(err).Msg("failed to ensure interface up")
|
l.Error().Err(err).Int("attempt", attempt).Msg("failed to ensure interface up")
|
||||||
resetTimer(t, c.l)
|
resetTimer(t, attempt, c.l)
|
||||||
|
attempt++
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -188,11 +197,14 @@ func (c *Client) requestLoop(t *time.Timer, family int, ifname string) {
|
||||||
lease, err = c.requestLease6(ifname)
|
lease, err = c.requestLease6(ifname)
|
||||||
}
|
}
|
||||||
if err != nil {
|
if err != nil {
|
||||||
l.Error().Err(err).Msg("failed to request lease")
|
l.Error().Err(err).Int("attempt", attempt).Msg("failed to request lease")
|
||||||
resetTimer(t, c.l)
|
resetTimer(t, attempt, c.l)
|
||||||
|
attempt++
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Successfully obtained lease, reset attempt counter
|
||||||
|
attempt = 0
|
||||||
c.handleLeaseChange(lease)
|
c.handleLeaseChange(lease)
|
||||||
|
|
||||||
nextRenewal := getRenewalTime(lease)
|
nextRenewal := getRenewalTime(lease)
|
||||||
|
|
|
||||||
|
|
@ -46,10 +46,10 @@ export default function SettingsHardwareRoute() {
|
||||||
}
|
}
|
||||||
|
|
||||||
setBacklightSettings(settings);
|
setBacklightSettings(settings);
|
||||||
handleBacklightSettingsSave();
|
handleBacklightSettingsSave(settings);
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleBacklightSettingsSave = () => {
|
const handleBacklightSettingsSave = (backlightSettings: BacklightSettings) => {
|
||||||
send("setBacklightSettings", { params: backlightSettings }, (resp: JsonRpcResponse) => {
|
send("setBacklightSettings", { params: backlightSettings }, (resp: JsonRpcResponse) => {
|
||||||
if ("error" in resp) {
|
if ("error" in resp) {
|
||||||
notifications.error(
|
notifications.error(
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue