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.7.tar.gz (245.2 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.7-py3-none-any.whl (9.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: debounce_redis_guard-0.0.7.tar.gz
  • Upload date:
  • Size: 245.2 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.7.tar.gz
Algorithm Hash digest
SHA256 228cb090b0de6184a2d96a7bc6e4c23d9e5eb0c45c9f1368cba331ba6a1e5563
MD5 1266af661068ba4e9f0ebcc047c9c47d
BLAKE2b-256 bacc092cd102786e06b350b2b045d19e3bd95e840a4529adaf08bd5f4b13a3b2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for debounce_redis_guard-0.0.7-py3-none-any.whl
Algorithm Hash digest
SHA256 54791cbf6b98c9abe3efcf595da762d1a2b9f98b081b88b110b44c74b1c2dddf
MD5 7d75c2354b79aae5de2661783041a927
BLAKE2b-256 793b8e4d99b5daef0a421d8b68de7b07890a6dcdc2a2cd2e380ea7c85fb3f4fe

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