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

Optimize polling #245

Merged
merged 3 commits into from
Jul 2, 2022
Merged

Optimize polling #245

merged 3 commits into from
Jul 2, 2022

Conversation

yubiuser
Copy link
Member

@yubiuser yubiuser commented Jun 30, 2022

What does this PR aim to accomplish?:

This PR solves more than one, but connected issues.
PADD has five GetXXXInformation routines which were executed every 5 seconds. One of them had a check (GetVersionInformation) that the function is only executed once a day by writing today into the piHoleVersion_file and checking that date against now. On every startup or after a date change the file was deleted to update the information.
All other GetXXXInformation routines did not have such a check. But some of those gathered information are unlikely to update every 5 seconds, e.g. hostname, IPv4 address, DNSSEC status, etc.

To allow setting individual polling times, each GetXXXInformation routine is now wrapped in a checker, which checks that last execution time is more than xx seconds in the past.
This also allows us to get rid of the piHoleVersion_file which was basically used to hold a timestamp and some information for re-use.


Additionally, this PR

  • fixes a bug which was introduced by 06fe88f where setupVars.conf was only sourced at the beginning of the script. However, we need to source repeatedly to check if settings (like DNSSEC status) have changed

  • added GetPiholeInformation to the startup routine for ${padd_size}=mini. This was likely forgotten a long time ago already

  • moves the sleep 5 above the execution of the GetXXXInformation routines which allows to display "non-stale" (5 sec old) data

  • adds a few missing "size"_status, see PR update status of mega screen size #144 for one of them

  • How does this PR accomplish the above?:

Add individual timers for each check. Remove now unused piHoleVersion_file


P.S. Comparison on GH looks worse than in reality. Most are indention changes in GetVersionInformation


By submitting this pull request, I confirm the following:

  1. I have read and understood the contributors guide, as well as this entire template. I understand which branch to base my commits and Pull Requests against.
  2. I have commented my proposed changes within the code and I have tested my changes.
  3. I am willing to help maintain this change if there are issues with it later.
  4. It is compatible with the EUPL 1.2 license
  5. I have squashed any insignificant commits. (git rebase)

  • I have read the above and my PR is ready for review. Check this box to confirm

@yubiuser yubiuser requested a review from a team June 30, 2022 12:13
This was referenced Jun 30, 2022
@dschaper
Copy link
Member

Do you want to squash some of those commits down to one or two?

@yubiuser
Copy link
Member Author

yubiuser commented Jul 1, 2022

I squashed it down to three ;-)

Signed-off-by: Christian König <[email protected]>

Source setupVars.conf when needed to reflect changes in Pi-hole config

Signed-off-by: Christian König <[email protected]>

Change greater than to greater or equal

Signed-off-by: Christian König <[email protected]>
Co-authored-by: Scott Smith <[email protected]>
Signed-off-by: Christian König <[email protected]>

Also GetPiholeInformation in mini during startup

Signed-off-by: Christian König <[email protected]>

Remove trailing underscores

Signed-off-by: Christian König <[email protected]>
@yubiuser
Copy link
Member Author

yubiuser commented Jul 1, 2022

Rebased on latest development

@yubiuser yubiuser merged commit d74f60d into development Jul 2, 2022
@yubiuser yubiuser deleted the reduce_load branch July 2, 2022 07:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants