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

Python asyncio Integration - Notifications sent Asynchronously #273

Merged
merged 6 commits into from Aug 16, 2020

Conversation

caronc
Copy link
Owner

@caronc caronc commented Aug 15, 2020

Description:

Apprise sends each notification one after another (sequentially). Leveraging the async/await with the asyncio library would allow one to send all of the pending notifications at the same time.

This feature identified in this PR only works with Python 3 platforms. Python v2 users will always send via the synchronous method (as they have in the past).

  • Feature is toggle-able from the CLI. Added --disable-async (-Da) which allows Python 3 instances of Apprise to behave the way it once did (before this pull request) and sequentially send the notifications.
  • Added a --debug (-D) switch to the CLI as well which not only defaults the logging verbosity to DEBUG level, it additionally sets the asyncio module in debug mode under the hood.
  • You can set async_mode to False (it defaults to True) in the AppriseAsset() object if you want to go back to the legacy way of sending notifications.

Other things to note from this PR:

  • the async_mode is at a notification service level. So developers can set some notifications to run asynchronously and others to run synchronously if they wish. This is determined by the AppriseAsset loaded per notification plugin.

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

@caronc caronc force-pushed the python3-async-support branch 9 times, most recently from e815f5f to a6a0192 Compare August 15, 2020 19:26
@codecov-commenter
Copy link

codecov-commenter commented Aug 15, 2020

Codecov Report

Merging #273 into master will not change coverage.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff            @@
##            master      #273   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           82        83    +1     
  Lines         9703      9756   +53     
  Branches      1551      1562   +11     
=========================================
+ Hits          9703      9756   +53     
Impacted Files Coverage Δ
apprise/Apprise.py 100.00% <100.00%> (ø)
apprise/AppriseAsset.py 100.00% <100.00%> (ø)
apprise/cli.py 100.00% <100.00%> (ø)
apprise/plugins/NotifyBase.py 100.00% <100.00%> (ø)
apprise/py3compat/asyncio.py 100.00% <100.00%> (ø)

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 4f4b15d...b5695c1. Read the comment docs.

@caronc caronc changed the title Python asyncio integration - Notifications sent Asynchronously Python asyncio Integration - Notifications sent Asynchronous Aug 16, 2020
@caronc caronc merged commit aa039e7 into master Aug 16, 2020
@caronc caronc changed the title Python asyncio Integration - Notifications sent Asynchronous Python asyncio Integration - Notifications sent Asynchronously Aug 16, 2020
@caronc caronc deleted the python3-async-support branch August 17, 2020 02:03
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