-
Notifications
You must be signed in to change notification settings - Fork 5
Feature: SQLite-based Message Cache #31
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
Conversation
After introducing the AlephClientInterface, I get a mypy error, that I really don't get: https://github.com/aleph-im/aleph-sdk-python/actions/runs/5071082316/jobs/9107016057?pr=31 Even though I am exactly copying the signature of the async def watch_messages(
self,
message_type: Optional[MessageType] = None,
content_types: Optional[Iterable[str]] = None,
refs: Optional[Iterable[str]] = None,
addresses: Optional[Iterable[str]] = None,
tags: Optional[Iterable[str]] = None,
hashes: Optional[Iterable[str]] = None,
channels: Optional[Iterable[str]] = None,
chains: Optional[Iterable[str]] = None,
start_date: Optional[Union[datetime, float]] = None,
end_date: Optional[Union[datetime, float]] = None,
) -> AsyncIterable[AlephMessage]: mypy raises: src/aleph/sdk/cache.py:370:5: |
Looking into snapshot testing to figure out how to mock API responses. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added a first batch of comments.
Thanks @hoh, this helps prioritizing on which points work on next for me. |
9d91846
to
af853c5
Compare
@hoh if isinstance(messages, AlephMessage): is making tests fail in Python versions =< 3.9. The alternative is making comparisons with every single Aleph message type ( As Python progressed already to 3.11 now, can it be expected of people wanting to use our newest SDK versions to use at least Python 3.10? |
The solution seems to be using https://stackoverflow.com/a/73874277
Not as long as we support Debian 11, which ships with Python 3.9. |
c585587
to
1aef599
Compare
* Feature : AlephDNS add instances support add ipfs support add program support --------- Co-authored-by: aliel <ali.elb@gmail.com>
…tartup Solution: Relay "lifespan" events from the AlephApp to the http_app
Co-authored-by: Hugo Herter <git@hugoherter.com>
…rs; refactor node.py; increase test coverage
3bb68f8
to
0a44e9d
Compare
So, resolved code duplication and other issues as pointed out by @hoh. I made some breaking changes on the interface of the Client, which should have been done anyways (like changing the return type of After extensive testing, whereby we are now reaching 61% test coverage, I am convinced that this branch is reliable and can be publicized in a future minor release. |
Closed for now, as it will be broken down into smaller PRs |
Problem
Some apps require access to the same messages over and over again. This puts unnecessary strain on the CCN API and increases the latency of apps using Aleph Messages.
Solution
This pull request proposes a solution by introducing a message cache implemented with Peewee and an SQLite database in the Aleph SDK. The message cache effectively stores frequently accessed messages, eliminating the need for repetitive CCN API calls. With the message cache in place, apps utilizing the Aleph SDK will experience enhanced efficiency and responsiveness in accessing messages.