[~] Refactor
This commit is contained in:
		
							parent
							
								
									33b78ca231
								
							
						
					
					
						commit
						6df412cf1e
					
				| @ -87,6 +87,7 @@ def service(): | ||||
|     logging.warning('start dynu_update') | ||||
| 
 | ||||
|     need_wait = False | ||||
|     last_disabled = False | ||||
| 
 | ||||
|     while True: | ||||
|         try: | ||||
| @ -101,9 +102,13 @@ def service(): | ||||
|                 dynu_config = json.load(f) | ||||
| 
 | ||||
|             if dynu_config.get('enabled') != True: | ||||
|                 logging.warning('disabled') | ||||
|                 if not last_disabled: | ||||
|                     last_disabled = True | ||||
|                     logging.warning('disabled') | ||||
|                 need_wait = True | ||||
|                 continue | ||||
|             else: | ||||
|                 last_disabled = False | ||||
|                 logging.warning('loaded dynu_config') | ||||
| 
 | ||||
|             with multiprocessing.Pool(processes=1) as pool: | ||||
|  | ||||
| @ -3,10 +3,4 @@ WORKDIR /app | ||||
| 
 | ||||
| RUN pip3 install requests | ||||
| 
 | ||||
| ENTRYPOINT /bin/sh -c "\ | ||||
|   while true; do \ | ||||
|     date; \ | ||||
|     python3 d1/dynu_update.py tmp/cache/dynu.auth.json ngrok; \ | ||||
|     sleep 900; \ | ||||
|   done; \ | ||||
| " | ||||
| ENTRYPOINT exec python3 d1/dynu_update tmp/cache/dynu.auth.json ngrok | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user