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

Fix unsubscribe pattern #5

Merged
merged 5 commits into from
Sep 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions .github/workflows/build_beta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ jobs:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: Ensure python 3.11
uses: actions/setup-python@v4
- name: Ensure python 3.12
uses: actions/setup-python@v5
with:
python-version: '3.11'
python-version: '3.12'
- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Install dependencies
run: pip install -r requirements.txt; pip install pylint==${{ secrets.PYLINT_VERSION }}
- name: Run lint
Expand All @@ -27,14 +27,14 @@ jobs:
- name: Verify tag
run: echo ${{ steps.docker_tag.outputs.tag }}
- name: Login to GCR
uses: docker/login-action@v2
uses: docker/login-action@v3
with:
registry: us-docker.pkg.dev
username: _json_key
password: ${{ secrets.GCR_JSON_KEY }}
- name: Build and push
id: docker_build
uses: docker/build-push-action@v3
uses: docker/build-push-action@v5
with:
push: true
pull: true
Expand All @@ -44,7 +44,7 @@ jobs:
tags: us-docker.pkg.dev/plaidcloud-build/us-plaidcloud/redistomp:latest,us-docker.pkg.dev/plaidcloud-build/us-plaidcloud/redistomp:${{ steps.docker_tag.outputs.tag }}

- name: Checkout GitOps Repository
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
repository: PlaidCloud/plaid-tenant-infrastructure
ref: beta
Expand Down
14 changes: 7 additions & 7 deletions .github/workflows/build_io.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ jobs:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: Ensure python 3.11
uses: actions/setup-python@v4
- name: Ensure python 3.12
uses: actions/setup-python@v5
with:
python-version: '3.11'
python-version: '3.12'
- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Install dependencies
run: pip install -r requirements.txt; pip install pylint==${{ secrets.PYLINT_VERSION }}
- name: Run lint
Expand All @@ -27,14 +27,14 @@ jobs:
- name: Verify tag
run: echo ${{ steps.docker_tag.outputs.tag }}
- name: Login to GCR
uses: docker/login-action@v2
uses: docker/login-action@v3
with:
registry: us-docker.pkg.dev
username: _json_key
password: ${{ secrets.GCR_JSON_KEY }}
- name: Build and push
id: docker_build
uses: docker/build-push-action@v3
uses: docker/build-push-action@v5
with:
push: true
pull: true
Expand All @@ -44,7 +44,7 @@ jobs:
tags: us-docker.pkg.dev/plaidcloud-build/us-plaidcloud/redistomp:latest,us-docker.pkg.dev/plaidcloud-build/us-plaidcloud/redistomp:${{ steps.docker_tag.outputs.tag }}

- name: Checkout GitOps Repository
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
repository: PlaidCloud/plaid-tenant-infrastructure
ref: master
Expand Down
16 changes: 8 additions & 8 deletions .github/workflows/pr_lint.yaml
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
name: Lint PlaidCloud RPC Service
name: Lint RediStomp Service
on:
pull_request:
branches:
- master
- main
jobs:
reviewdog:
name: Lint RediStomp w ReviewDog
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- name: Ensure python 3.11
uses: actions/setup-python@v4
- name: Ensure python 3.12
uses: actions/setup-python@v5
with:
python-version: '3.11'
python-version: '3.12'
- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Acquire list of changed python files
id: all-python-files
continue-on-error: true
uses: tj-actions/changed-files@v37
uses: tj-actions/changed-files@v45
with:
files: |
**/*.py
Expand All @@ -45,4 +45,4 @@ jobs:
env:
REVIEWDOG_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
pylint -s n -f text -E plaid 2>&1 | reviewdog -efm="%f:%l:%c: %m" -name="PyLint Errors" -reporter=github-check -filter-mode=nofilter -fail-on-error
pylint -s n -f text -E redis_stomp 2>&1 | reviewdog -efm="%f:%l:%c: %m" -name="PyLint Errors" -reporter=github-check -filter-mode=nofilter -fail-on-error
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM python:3.11-slim
FROM python:3.12-slim

ARG RUN_AS_USER
ARG REDIS_URL
Expand Down
13 changes: 7 additions & 6 deletions redis_stomp/pubsub/topic.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,12 +94,13 @@
if not redis_destination:
return
await super().unsubscribe(connection, redis_destination, id)
if glob.has_magic(redis_destination):
LOGGER.debug(f'PUNSUBSCRIBE: {redis_destination}')
await asyncio.to_thread(self._redis.punsubscribe, redis_destination)
else:
LOGGER.debug(f'UNSUBSCRIBE: {redis_destination}')
await asyncio.to_thread(self._redis.unsubscribe, redis_destination)
if await self._subscriptions.subscriber_count(redis_destination) == 0:
if glob.has_magic(redis_destination):
LOGGER.debug(f'PUNSUBSCRIBE: {redis_destination}')

Check warning on line 99 in redis_stomp/pubsub/topic.py

View workflow job for this annotation

GitHub Actions / PyLint Warnings

[PyLint Warnings] redis_stomp/pubsub/topic.py#L99

W1203: Use lazy % formatting in logging functions (logging-fstring-interpolation)
Raw output
redis_stomp/pubsub/topic.py:99:16: W1203: Use lazy % formatting in logging functions (logging-fstring-interpolation)
await asyncio.to_thread(self._redis.punsubscribe, redis_destination)
else:
LOGGER.debug(f'UNSUBSCRIBE: {redis_destination}')

Check warning on line 102 in redis_stomp/pubsub/topic.py

View workflow job for this annotation

GitHub Actions / PyLint Warnings

[PyLint Warnings] redis_stomp/pubsub/topic.py#L102

W1203: Use lazy % formatting in logging functions (logging-fstring-interpolation)
Raw output
redis_stomp/pubsub/topic.py:102:16: W1203: Use lazy % formatting in logging functions (logging-fstring-interpolation)
await asyncio.to_thread(self._redis.unsubscribe, redis_destination)

async def next_message(self):
# ToDo: This could be done by registering a callback on subscribe which might be more favorable, I dunno
Expand Down
12 changes: 6 additions & 6 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
anyio==4.0.0
anyio==4.4.0
coilmq@git+https://github.com/rad-pat/coilmq.git@asyncio#egg=coilmq
redis==5.0.1
starlette==0.31.1
uvicorn==0.23.2
uvloop==0.19.0
websockets==12.0
redis==5.0.8
starlette==0.38.5
uvicorn==0.30.6
uvloop==0.20.0
websockets==13.0.1
Loading