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

When the scan interval is modified, the scan loop should proceed #5

Open
udhos opened this issue Apr 12, 2018 · 0 comments
Open

When the scan interval is modified, the scan loop should proceed #5

udhos opened this issue Apr 12, 2018 · 0 comments
Assignees

Comments

@udhos
Copy link
Owner

udhos commented Apr 12, 2018

Need to interrupt time.Sleep(sleep) below:

func scanLoop(jaz *app) {
        for {
                jaz.logf("scanLoop: starting")
                opt := jaz.options.Get()
                begin := time.Now()
                dev.Scan(jaz.table, jaz.table.ListDevices(), jaz.logger, opt, jaz.requestChan)
                elap := time.Since(begin)
                sleep := opt.ScanInterval - elap
                if sleep < 1 {
                        sleep = 0
                }
                jaz.logf("scanLoop: sleeping for %s (target: scanInterval=%s)", sleep, opt.ScanInterval)
                time.Sleep(sleep)
        }
}

@udhos udhos self-assigned this May 21, 2023
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

1 participant