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

make naz.SimpleCorrelater.delete_after_ttl() private #172

Merged
merged 4 commits into from
Oct 17, 2019
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
6 changes: 3 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ jobs:
GIT_BRANCH: ${{ github.ref }}
run: |
echo $GIT_BRANCH
if [ "$GIT_BRANCH" == "refs/heads/master" ]
if [[ "$GIT_BRANCH" == "refs/heads/master" ]]
then
printf "\n $GIT_BRANCH branch, ignoring check for relese notes \n"
elif [ "$GIT_BRANCH" == *"refs/tags/"* ]
elif [[ "$GIT_BRANCH" == *"refs/tags/"* ]]
then
printf "\n $GIT_BRANCH branch, ignoring check for relese notes \n"
else
Expand Down Expand Up @@ -66,7 +66,7 @@ jobs:
tests:
name: tests
runs-on: ubuntu-18.04
timeout-minutes: 4
timeout-minutes: 6
steps:
- name: Set up python
uses: actions/setup-python@v1
Expand Down
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
most recent version is listed first.


## **version:** v0.7.3
- make `naz.SimpleCorrelater.delete_after_ttl()` private: https://github.com/komuw/naz/pull/172


## **version:** v0.7.2
- fix infinite loop bug, which could occur while re-establishing connection & re-binding to SMSC: https://github.com/komuw/naz/pull/171
Expand Down
2 changes: 1 addition & 1 deletion naz/__version__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"__title__": "naz",
"__description__": "Naz is an async SMPP client.",
"__url__": "https://github.com/komuw/naz",
"__version__": "v0.7.2",
"__version__": "v0.7.3",
"__author__": "komuW",
"__author_email__": "[email protected]",
"__license__": "MIT",
Expand Down
8 changes: 4 additions & 4 deletions naz/correlater.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ async def put(
}

# garbage collect
await self.delete_after_ttl()
await self._delete_after_ttl()

async def get(
self,
Expand All @@ -144,14 +144,14 @@ async def get(
item = self.store.get(sequence_number)
if not item:
# garbage collect
await self.delete_after_ttl()
await self._delete_after_ttl()
return "", ""

# garbage collect
await self.delete_after_ttl()
await self._delete_after_ttl()
return item["log_id"], item["hook_metadata"]

async def delete_after_ttl(self) -> None:
async def _delete_after_ttl(self) -> None:
"""
iterate over all stored items and delete any that are
older than self.max_ttl seconds
Expand Down
4 changes: 2 additions & 2 deletions tests/test_correlater.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ def test_get(self):

def test_get_calls_delete(self):
with mock.patch(
"naz.correlater.SimpleCorrelater.delete_after_ttl", new=AsyncMock()
"naz.correlater.SimpleCorrelater._delete_after_ttl", new=AsyncMock()
) as mock_correlater_delete_after_ttl:
self._run(
self.correlater.get(
Expand All @@ -113,7 +113,7 @@ def test_get_calls_delete(self):

def test_put_calls_delete(self):
with mock.patch(
"naz.correlater.SimpleCorrelater.delete_after_ttl", new=AsyncMock()
"naz.correlater.SimpleCorrelater._delete_after_ttl", new=AsyncMock()
) as mock_correlater_delete_after_ttl:
self._run(
self.correlater.put(
Expand Down