* Feat: Added parallel limiter to prevent sqlalchemy transaction issues * Remove logs * Moved initialization to its own file * Throw exception * Added test * Add redis to gh actions * Added v6 to the name * Removed debug prints Co-authored-by: Adrià Casajús <adria.casajus@proton.ch>
14 lines
415 B
Python
14 lines
415 B
Python
from flask_login import login_user
|
|
|
|
from app.parallel_limiter import _InnerLock
|
|
from tests.utils import create_new_user
|
|
|
|
|
|
def test_parallel_limiter(flask_app):
|
|
user = create_new_user()
|
|
with flask_app.test_request_context():
|
|
login_user(user)
|
|
pl = _InnerLock("test", max_wait_secs=1, wait_loop_secs=0.1)
|
|
for loop_id in range(10):
|
|
assert pl(lambda x: x)(loop_id) == loop_id
|