@@ -92,37 +92,30 @@ def no_op_decorator(func):
9292
9393 return no_op_decorator
9494
95- return self ._create_single_decorator (exceptions , self )
96-
97- def _create_single_decorator (self , exc_set : Set [Type [Exception ]], config : "BackoffConfig" ):
98- """Create a single backoff decorator for a set of exceptions."""
99- if not exc_set :
100- return None
101-
102- if config .strategy == "expo" :
95+ if self .strategy == "expo" :
10396 return backoff .on_exception (
10497 backoff .expo ,
105- tuple (exc_set ),
106- max_tries = config .max_tries ,
107- base = config .base_delay ,
108- max_value = config .max_delay ,
109- factor = config .factor ,
110- jitter = config .jitter ,
111- giveup = config .giveup_func ,
112- raise_on_giveup = config .raise_on_giveup ,
98+ tuple (exceptions ),
99+ max_tries = self .max_tries ,
100+ base = self .base_delay ,
101+ max_value = self .max_delay ,
102+ factor = self .factor ,
103+ jitter = self .jitter ,
104+ giveup = self .giveup_func ,
105+ raise_on_giveup = self .raise_on_giveup ,
113106 )
114- elif config .strategy == "constant" :
107+ elif self .strategy == "constant" :
115108 return backoff .on_exception (
116109 backoff .constant ,
117- tuple (exc_set ),
118- max_tries = config .max_tries ,
119- interval = config .base_delay ,
120- jitter = config .jitter ,
121- giveup = config .giveup_func ,
122- raise_on_giveup = config .raise_on_giveup ,
110+ tuple (exceptions ),
111+ max_tries = self .max_tries ,
112+ interval = self .base_delay ,
113+ jitter = self .jitter ,
114+ giveup = self .giveup_func ,
115+ raise_on_giveup = self .raise_on_giveup ,
123116 )
124117 else :
125- raise ValueError (f"Unknown backoff strategy: { config .strategy } " )
118+ raise ValueError (f"Unknown backoff strategy: { self .strategy } " )
126119
127120
128121@dataclass
0 commit comments