Skip to main content

A Python library for debouncing requests with support for multiple workers.

Project description

debounce-redis-guard

DebounceMaster 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

Screenshot

Implementation Behavior with clone requests (time to time - within TTL duration) with ApiDebouncer: Sequence Diagram

Screenshot

Jmeter Summary Report Sample to Compair with and without debouncing feature

Screenshot

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

debounce_redis_guard-0.0.5-py3-none-any.whl (9.4 kB view details)

Uploaded Python 3

File details

Details for the file debounce_redis_guard-0.0.5-py3-none-any.whl.

File metadata

File hashes

Hashes for debounce_redis_guard-0.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 bd1c4a4968be1398523d928edd69a26fd5b154b0842ff7da82f1104af6b6912e
MD5 5c06c394b76ba66d724111ac638b083b
BLAKE2b-256 1ff3151b3ea4f84520b329937b776235ec8209857d3220482855f26e0cdb3761

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page