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 Distribution

debounce_redis_guard-0.0.6.tar.gz (245.1 kB view details)

Uploaded Source

Built Distribution

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

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

Uploaded Python 3

File details

Details for the file debounce_redis_guard-0.0.6.tar.gz.

File metadata

  • Download URL: debounce_redis_guard-0.0.6.tar.gz
  • Upload date:
  • Size: 245.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.11.2

File hashes

Hashes for debounce_redis_guard-0.0.6.tar.gz
Algorithm Hash digest
SHA256 4bf659dd5761f51e4e9104de96e337eeff89745cae5fd6bfd26f03051840dc3f
MD5 92291cdac193c3c50bb0e6cfcc701f03
BLAKE2b-256 d366bbaa29c340c983510eae86312c25ebc917864a780bf7f9bde661e6e927b6

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for debounce_redis_guard-0.0.6-py3-none-any.whl
Algorithm Hash digest
SHA256 5e5c26aeae27ff9031ad97af236a271bfae54ba3d8d993db5b3582408785b60c
MD5 a21b3f8f6bb29843de056fb306805b33
BLAKE2b-256 752809bc7c168e7f59e43a378c02d90e32252d6f84fda97b79b57e1bb2b9f1a3

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