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

Refactored configuration + cache support added #175

Merged
merged 1 commit into from
Nov 17, 2019
Merged

Conversation

caronc
Copy link
Owner

@caronc caronc commented Nov 17, 2019

Description:

Re-factored some of the AppriseConfig class to additionally support the cache= directive similar to how it works with Attachments. The idea is now you can tell Apprise not to cache the configuration files (which will cause them to retrieved each request made). This provides a more dynamic solution allowing your configuration to change while Apprise has already been loaded in memory.

For web requests, you can set things like cache=30 which will keep the last retrieved remote content for 30 seconds. All requests made within this time period will use the same configuration retrieved from that one remote request. After 30 seconds (in the case of this example) a new remote fetch for configuration is made (renewing it).

The default option is cache=Yes which causes Apprise to continue to behave as it had in the past; after a remote request for configuration has been made, it is re-used for the entire life of the program; no further requests are made.

You can also set cache=No to disable caching all together. This has a bit of overhead involved; but this might be your intention. Apprise URLs are queried from configuration files (regardless of where they are) each and every time.

Checklist

  • The code change is tested and works locally.
  • There is no commented out code in this PR.
  • No lint errors (use flake8)
  • 100% test coverage

@codecov-io
Copy link

codecov-io commented Nov 17, 2019

Codecov Report

Merging #175 into master will not change coverage.
The diff coverage is 100%.

Impacted file tree graph

@@          Coverage Diff          @@
##           master   #175   +/-   ##
=====================================
  Coverage     100%   100%           
=====================================
  Files          68     68           
  Lines        7753   7801   +48     
  Branches     1244   1253    +9     
=====================================
+ Hits         7753   7801   +48
Impacted Files Coverage Δ
apprise/config/__init__.py 100% <ø> (ø) ⬆️
apprise/attachment/AttachBase.py 100% <100%> (ø) ⬆️
apprise/config/ConfigHTTP.py 100% <100%> (ø) ⬆️
apprise/config/ConfigBase.py 100% <100%> (ø) ⬆️
apprise/AppriseConfig.py 100% <100%> (ø) ⬆️
apprise/config/ConfigFile.py 100% <100%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update e5c0334...77aa165. Read the comment docs.

@caronc caronc merged commit c8a5d3b into master Nov 17, 2019
@caronc caronc deleted the config-refactored branch November 18, 2019 15:32
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