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

Creating bucket and schedule leak #117

Merged
merged 3 commits into from
Aug 16, 2023

Conversation

vutran1710
Copy link
Owner

No description provided.

@vutran1710 vutran1710 merged commit 62dd9e8 into pyrate-limiter-v3 Aug 16, 2023
1 check was pending
@vutran1710 vutran1710 deleted the creating-bucket-and-schedule-leak branch August 16, 2023 12:14
vutran1710 added a commit that referenced this pull request Aug 27, 2023
* ignore DS_Store

* remove python-version to fix lsp

* testing binary-search on finding rates

* new rate module

* update

* refactor LimitContextDecorator

* move validate_rate_list out of limiter class

* allow both async & sync

* BucketFactory can produce both Async & Sync Bucket

* format

* Add defaultBucketFactory

* not neccessary copy

* clean up

* line break

* lock

* Fix

* Fix type check

* fix

* dict literal

* Add leak to abstract buckets

* leak task

* clean up

* make utils to includes atomic values

* update

* move rate validator to utils

* more tests

* naming fix

* update test

* update docstring for SimpleListBucket

* Add abstract clock

* add abstract clock, move to abstracts

* configure test to use multi clocks

* update test

* test insert heavy item

* Add leak

* rename to buckets.py

* move to buckets

* Update SqLiteBucket

* fix

* add put to sqlite

* rename method

* update test

* Make clock optional

* add note

* Test sqliteBucket leak

* clean up

* rename

* clean up readme

* use RLock instead of Lock

* Add abstract flush method and implement for all buckets

* refactor

* Update

* Update

* use temp file for sqlite db

* fix lint

* test flush

* fix naming

* rename test files

* update dependencies

* update

* remove types-redis

* Add note

* flush

* separate method put

* Add id-generator

* Add lua script

* separate keys & args

* assert failing-rate

* fix pytest name collision on parallel run

* fix naming

* Add more test

* add leak script

* use remrangebyscore

* fix

* use timestamp instead of clock class

* refactor

* assert

* Use single script

* refactor

* update

* fix

* separate pool to avoid concurrency bug

* add doc string

* load script

* refactor

* Separate util test

* clean up

* cover missing cases

* use lock instead of rlock

* More exception

* fix

* Add limiter

* Refactor

* RateItem str method

* Add test for limiter

* Refactor bucket-factory & limiter

* remove not needed exception

* update test

* Update test

* Add stress-test for sqliteBucket

* Move clock logic to bucketFactory

* More tests

* fix test, limit number of nox process to reduce flakiness

* Add redis to CI

* fix ci

* no limit on pytest processes

* fix test

* fix lint

* Use Rloc

* update sqliteBucket query check

* update sqliteBucket & test

* fix test

* fix ci

* rename ci service

* change redis host for ci

* use temp dir for sqlite3

* simplify clock

* Fix test

* Simplify bucket interface

* fix test

* no close

* single process to ensure stability

* all buckets must implement count

* Refactor test set for buckets

* fix lint

* Add notes

* more assertion

* bump version

* fix redis version

* update readme on installation

* Add Duration enum

* Update test

* bump pyYAML

* Update test

* Fix test sqliteBucket

* Add limiter decorator

* TypeAlias for item-mapping function

* More type-alias, assert mapping function

* Fix wrong return type for decorator

* Pyrate limiter v3:  delay + Async Redis Bucket (#114)

* Add abstractmethod `availability` to check for bucket availability

* Implement availability for InMemoryBucket

* small note

* Add test inMemoryBucket's  availability implementation

* Update test & availability method

* Update test

* Update test, fix lint

* Use delay on limiter

* fix test

* Add MockAsyncClock for testing

* Refactor test to improve converage

* Refactor: Type Alias

* Clean up notes

* not needed noqa-s

* MockAsyncClock: allow overriding method signature

* Convert RedisSyncBucket to General RedisBucket that can work with both
sync & async

* Update test for AsyncRedis Bucket

* bump pytest-cov

* bump

* coverage report html

* Fix type

* fix long line

* drop 3.7

* Refactor get-bucket-availability

* stricter BucketFactory interface

* remove BucketRetrievalFail

* replace iscoroutine with isawaitable, add delay_or_raise to limiter

* Refactor to use Awaitable instead of Coroutine

* clean up

* Add note

* Update test delay for limiter

* Update delay test

* fix validate_rate_list test

* Update test, add logger

* Refactor clock implementations

* Move create-bucket fixture to pytest conftest.py

* fix python version for github ci

* Use 1 clock for performance test

* Refactor limiter test

* Fix bucket's peek implementations & fix get-bcket-availability

* Move BucketAsyncWrapper to abstract/bucket

* Refactor test-bucket-all

* fix performance test

* Refactor bucket availability (#115)

* refactor get-bucket-availability to bucket.waiting

* fix test

* rename test

* Reduce cycocomplexity of delay_or_raise function

* clean up dead code

* Refactor: no delay when no failing-rate

* Refactor: no flag

* Refactor: default init for SQLiteClock

* Remove lock at bucket level

* Add multi-threaded test, add lock to limiter

* Remove not needed dev-dependencies

* Clean up + add docstring

* Fix test bucket.waiting redis: bucket flaky

* Restore readme

* Add `add` to Duration

* Update docstring, remove schedule_flush

* clean up, docstring & little refactor

* Update docstring

Modified-by: vutran1710 <me@vutr.io>

* Creating bucket and schedule leak (#117)

* add `BucketFactory.create` method

* Update schedule-leak method

* Update test & fix schdedule-leak

* Refactor typing

* clean up

* Refactor factory leak test

* Simplify limiter test using only 1 BucketFactory implementation

* Update docs

* Refactor exports

* Update changelog & add supported python version

* not sure if we need TYPE_CHECKING

* Fix components image

* Add relative path to components.jpg for local display

* fix fixture test docstring

* refactor doc

* Update docs: item weight

* Add weight to exceptions

* Update readme: add Note on bucket's item consumption atomicity

* Allow Limiter to use single bucket in constructor

* Fix docs

* refactor test

* rename Clock to AbstractClock

* Export everything at top level

* Rename `allowed_delay` to `max_delay`

* clearer error message

* Refactor readme

* clearer asstion fail messages

* Add missing decorator usage to ReadME

* Update changelog
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

1 participant