Compare commits
	
		
			4 Commits
		
	
	
		
			714bf4c863
			...
			lasso-1
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| c7cc0079a8 | |||
| c5522e8c72 | |||
| 7ecfd10d50 | |||
| d75baceae9 | 
@ -7,7 +7,7 @@
 | 
				
			|||||||
        "gasAdjustment": 1.0,
 | 
					        "gasAdjustment": 1.0,
 | 
				
			||||||
        "nodeRpc": "###RPC_URL###",
 | 
					        "nodeRpc": "###RPC_URL###",
 | 
				
			||||||
        "maxRetries": 10,
 | 
					        "maxRetries": 10,
 | 
				
			||||||
        "delay": 10,
 | 
					        "delay": 30,
 | 
				
			||||||
        "submitTx": false
 | 
					        "submitTx": false
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    "worker": [
 | 
					    "worker": [
 | 
				
			||||||
 | 
				
			|||||||
@ -2,7 +2,6 @@ import subprocess
 | 
				
			|||||||
import json
 | 
					import json
 | 
				
			||||||
import sys
 | 
					import sys
 | 
				
			||||||
import time
 | 
					import time
 | 
				
			||||||
import os
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
def is_json(myjson):
 | 
					def is_json(myjson):
 | 
				
			||||||
    try:
 | 
					    try:
 | 
				
			||||||
@ -11,7 +10,7 @@ def is_json(myjson):
 | 
				
			|||||||
        return False
 | 
					        return False
 | 
				
			||||||
    return True
 | 
					    return True
 | 
				
			||||||
 | 
					
 | 
				
			||||||
def parse_logs():
 | 
					def parse_logs(timeout):
 | 
				
			||||||
    start_time = time.time()
 | 
					    start_time = time.time()
 | 
				
			||||||
    while True:
 | 
					    while True:
 | 
				
			||||||
        unsuccessful_attempts = 0
 | 
					        unsuccessful_attempts = 0
 | 
				
			||||||
@ -50,26 +49,28 @@ def parse_logs():
 | 
				
			|||||||
                            return False, "Max Retry Reached"
 | 
					                            return False, "Max Retry Reached"
 | 
				
			||||||
        except Exception as e:
 | 
					        except Exception as e:
 | 
				
			||||||
            print(f"Exception occurred: {e}", flush=True)
 | 
					            print(f"Exception occurred: {e}", flush=True)
 | 
				
			||||||
        finally:
 | 
					 | 
				
			||||||
            process.stdout.close()
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
        print("Sleeping before next log request...", flush=True)
 | 
					        print("Sleeping before next log request...", flush=True)
 | 
				
			||||||
        time.sleep(30)
 | 
					        time.sleep(30)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if time.time() - start_time > 30 * 60:
 | 
					        if time.time() - start_time > timeout * 60:
 | 
				
			||||||
            print("Timeout reached: 30 minutes elapsed without success.", flush=True)
 | 
					            print(f"Timeout reached: {timeout} minutes elapsed without success.", flush=True)
 | 
				
			||||||
            return False, "Timeout reached: 30 minutes elapsed without success."
 | 
					            return False, f"Timeout reached: {timeout} minutes elapsed without success."
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    return False, "No Success"
 | 
					    return False, "No Success"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
if __name__ == "__main__":
 | 
					if __name__ == "__main__":
 | 
				
			||||||
    print("Parsing logs...")    
 | 
					    print("Parsing logs...")
 | 
				
			||||||
    result = parse_logs()
 | 
					    if len(sys.argv) > 1: 
 | 
				
			||||||
 | 
					        timeout = eval(sys.argv[1]) 
 | 
				
			||||||
 | 
					    else: 
 | 
				
			||||||
 | 
					        timeout = 30
 | 
				
			||||||
 | 
					    result = parse_logs(timeout)
 | 
				
			||||||
    print(result[1])
 | 
					    print(result[1])
 | 
				
			||||||
    if result[0] == False:
 | 
					    if result[0] == False:
 | 
				
			||||||
        print("Exiting 1...")
 | 
					        print("Exiting 1...")
 | 
				
			||||||
        os._exit(1)
 | 
					        sys.exit(1)
 | 
				
			||||||
    else:
 | 
					    else:
 | 
				
			||||||
        print("Exiting 0...")
 | 
					        print("Exiting 0...")
 | 
				
			||||||
        os._exit(0)
 | 
					        sys.exit(0)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user