A Python library for debouncing requests with support for multiple workers.
Project description
debounce-redis-guard
debounce-redis-guard is a Python library designed to handle debouncing of requests in applications that support multiple workers. This library helps to prevent multiple identical requests from being processed simultaneously, thus improving efficiency and reducing redundant processing.
Features
- Debounce requests to avoid duplicate processing
- Supports multiple workers
- Integration with Redis for distributed locking and caching
- Custom logging
Installation
pip install debounce-redis-guard
Initialize Debouncer with logger and Redis configuration
from debounce_redis_guard import Debouncer, RedisConfig
debouncer = Debouncer(logger=my_logger, redis_config=my_redis_config)
Usage
@debouncer.debounce(ttl=60, function_name='my_function', identity_name='data')
async def my_function(data):
# Your function logic here
return {'message': 'Processed'}
Example Usage
@router.get("/perform-final-payment", , name="final payment perform by users - should only call one time.")
@debouncer.debounce(ttl=599, function_name="getAllPaymentGatewayList")
async def finalPay():
response = code functionality
return response
Implementation Behavior with Concurrent clone request with ApiDebouncer: Sequence Diagram
Implementation Behavior with clone requests (time to time - within TTL duration) with ApiDebouncer: Sequence Diagram
Jmeter Summary Report Sample to Compair with and without debouncing feature
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file debounce_redis_guard-0.0.8.tar.gz.
File metadata
- Download URL: debounce_redis_guard-0.0.8.tar.gz
- Upload date:
- Size: 245.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.11.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6a8c3f5ccaa3ca6689a020722d8e0ac6655b83bca1c8fd5a3c84f84f2a92c69e
|
|
| MD5 |
de547b8d5fe7ddab2e7845af5c1ef432
|
|
| BLAKE2b-256 |
609451f94d4bc9ddc99ea55f1cbd1b25f77a7293a1f248c76a1c288937c11f29
|
File details
Details for the file debounce_redis_guard-0.0.8-py3-none-any.whl.
File metadata
- Download URL: debounce_redis_guard-0.0.8-py3-none-any.whl
- Upload date:
- Size: 9.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.11.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
997fcc05e0cb93628fee45a3695ee2c2f73779afa98a08c397e12e54b57ac12c
|
|
| MD5 |
d5964da8eb3481c5363137237d0663df
|
|
| BLAKE2b-256 |
2d65ffa3fef578281bc2608c1d0615dcab1654bd7c433150b17c9b1444ae1fca
|