Spaces:
Sleeping
Sleeping
Commit ·
0a8c489
1
Parent(s): 63ab174
proxy pool race condition fixed
Browse files- freeplay2api.py +6 -4
freeplay2api.py
CHANGED
|
@@ -173,6 +173,12 @@ class FreeplayClient:
|
|
| 173 |
while attempt < 50: # Try up to 50 times
|
| 174 |
attempt += 1
|
| 175 |
logging.info(f"LOOP ITERATION {attempt} STARTED")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 176 |
proxy_info = None
|
| 177 |
try:
|
| 178 |
payload = {
|
|
@@ -236,10 +242,6 @@ class FreeplayClient:
|
|
| 236 |
logging.error(f"An unexpected error occurred during registration on attempt {attempt}/50: {e}. Retrying...")
|
| 237 |
logging.info(f"CONTINUING AFTER UNEXPECTED ERROR TO ATTEMPT {attempt + 1}")
|
| 238 |
|
| 239 |
-
# Wait 2 seconds between attempts to give proxy pool time to refill
|
| 240 |
-
if attempt < 50:
|
| 241 |
-
logging.info(f"Waiting 2 seconds before attempt {attempt + 1}...")
|
| 242 |
-
time.sleep(2)
|
| 243 |
|
| 244 |
logging.error("Failed to register a new account after 50 attempts.")
|
| 245 |
logging.info("REGISTER FUNCTION ENDING")
|
|
|
|
| 173 |
while attempt < 50: # Try up to 50 times
|
| 174 |
attempt += 1
|
| 175 |
logging.info(f"LOOP ITERATION {attempt} STARTED")
|
| 176 |
+
|
| 177 |
+
# Wait 2 seconds between attempts (except for the first attempt)
|
| 178 |
+
if attempt > 1:
|
| 179 |
+
logging.info(f"Waiting 2 seconds before attempt {attempt}...")
|
| 180 |
+
time.sleep(2)
|
| 181 |
+
|
| 182 |
proxy_info = None
|
| 183 |
try:
|
| 184 |
payload = {
|
|
|
|
| 242 |
logging.error(f"An unexpected error occurred during registration on attempt {attempt}/50: {e}. Retrying...")
|
| 243 |
logging.info(f"CONTINUING AFTER UNEXPECTED ERROR TO ATTEMPT {attempt + 1}")
|
| 244 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 245 |
|
| 246 |
logging.error("Failed to register a new account after 50 attempts.")
|
| 247 |
logging.info("REGISTER FUNCTION ENDING")
|