Skip to content

The circuit breaker design pattern for nextocord application commands

License

Notifications You must be signed in to change notification settings

teaishealthy/cordcutter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🔌 Cordcutter

Cordcutter is a nextcord extension that implements the circuit breaker design pattern for application commands.

Cordcutter works by watching for errors in your application commands and once the error threshold is reached (breaker tripped), it will disable the command for a set period of time. Once the cool-down period is over, the command will be re-enabled (breaker reset).

Cordcutter currently does not implement an semi-stable circuit breaker (half-open / half-tripped state), but this is a planned feature.

For more information on the circuit breaker design pattern, see this wikipedia article.

Installation

Cordcutter is currently in development and is not yet available on PyPI. You can install it from Git using pip:

pip install git+https://github.com/teaishealthy/cordcutter.git

Usage

Simply import the Cordcutter class from cordcutter and pass your nextcord.Client instance to it.

from cordcutter import Cordcutter
# <snip>
cordcutter = Cordcutter(client)

Configuration

You can configure when the breaker trips and how long it stays tripped by passing the threshold and reset_after parameters to the Cordcutter constructor:

Cordcutter(
    client,
    threshold = 3,
    reset_after = timedelta(minutes=5)
)

About

The circuit breaker design pattern for nextocord application commands

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages