Skip to main content

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

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

Uploaded Python 3

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

Hashes for debounce_redis_guard-0.0.8.tar.gz
Algorithm Hash digest
SHA256 6a8c3f5ccaa3ca6689a020722d8e0ac6655b83bca1c8fd5a3c84f84f2a92c69e
MD5 de547b8d5fe7ddab2e7845af5c1ef432
BLAKE2b-256 609451f94d4bc9ddc99ea55f1cbd1b25f77a7293a1f248c76a1c288937c11f29

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for debounce_redis_guard-0.0.8-py3-none-any.whl
Algorithm Hash digest
SHA256 997fcc05e0cb93628fee45a3695ee2c2f73779afa98a08c397e12e54b57ac12c
MD5 d5964da8eb3481c5363137237d0663df
BLAKE2b-256 2d65ffa3fef578281bc2608c1d0615dcab1654bd7c433150b17c9b1444ae1fca

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