Skip to content

Commit

Permalink
Add ping when get redis client, add docs (#4)
Browse files Browse the repository at this point in the history
* Add ping when get redis client, add docs

* skip convert on adapter impl

* Add guide on sqs develop

* Add cov python version
  • Loading branch information
Wh1isper authored Jun 12, 2024
1 parent df42f7a commit 4f97b48
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 1 deletion.
1 change: 1 addition & 0 deletions .coveragerc
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ omit =
*/tests/*
redis_canal/tools.py
redis_canal/cli.py
redis_canal/adapter/impl/*
1 change: 1 addition & 0 deletions .github/workflows/test-python-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ jobs:
run: |
pytest -vv --cov-config=.coveragerc --cov-report term-missing --cov=redis_canal/ tests
- name: Upload coverage reports to Codecov
if: matrix.python-version == '3.10'
uses: codecov/[email protected]
with:
token: ${{ secrets.CODECOV_TOKEN }}
18 changes: 17 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,17 @@ Or use docker image

## Usage

WIP
Use CLI

- `redis-canal stream-to-queue` to start a daemon to consume redis stream and push to global queue
- `redis-canal queue-to-stream` to pull from global queue and push to redis stream

CLI args support `envvar`, which you can refer to [envs.py](./redis_canal/envs.py).

## TODO

- More adapter for Google PubSub, Kafka, etc
- Allows users to more easily configure the adapter(Now only support environment variables, within `Adapter`)

## Develop

Expand All @@ -54,3 +64,9 @@ Run unit-test before PR
```
pytest -v tests
```

### Develop sqs adapter

You need to configure your AWS account first. See [AWS CLI docs](https://docs.aws.amazon.com/cli/latest/userguide/cli-chap-configure.html) for more details.

Make sure your account has `sqs:*` permission. Then you can run `pytest -v tests/adapter/test_sqs_adapter.py` to test it.
1 change: 1 addition & 0 deletions redis_canal/tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ async def get_redis_client(
else:
redis_client = redis.from_url(redis_url, decode_responses=True)
try:
await redis_client.ping()
yield redis_client
finally:
await redis_client.aclose()
Expand Down

0 comments on commit 4f97b48

Please sign in to comment.