3 ms·
This is silly. If you don't have a single constant, you could have the situation where one piece of code had a maxRetry of 5, and another with a maxRetry of 2.
by steven2012 11y ago
This is silly. If you don't have a single constant, you could have the situation where one piece of code had a maxRetry of 5, and another with a maxRetry of 2. Good luck trying to figure out why things are failing when they should retrying 5 times.
- anthony_d 11y agoThe problem is you might (sometimes should) have different retry counts depending on what you're retrying. So MAX_RETRY (or whatever) isn't actually that meaningful when you run into the constant. It might actually be misleading.
- gknoy 11y agoThis is solveable with extra verbosity. # no: MAX_FAILS = 3 MAX_RETRIES = 5 # yes: MAX_API_CONNECTION_RETRIES = 3 MAX_COMPLEX_GRAPH_SOLVING_RETRIES = 5 Apologies for terrible names, but the point is that you should name the constant different things, so that it's clear what __kinds__ of retries you are capping.