remove threading from util
This commit is contained in:
		
							parent
							
								
									a472c4dc06
								
							
						
					
					
						commit
						dddd444e4d
					
				
							
								
								
									
										18
									
								
								util.py
								
								
								
								
							
							
						
						
									
										18
									
								
								util.py
								
								
								
								
							| 
						 | 
				
			
			@ -10,28 +10,10 @@ __status__ = "Development"
 | 
			
		|||
 | 
			
		||||
 | 
			
		||||
# Default
 | 
			
		||||
import threading
 | 
			
		||||
import logging
 | 
			
		||||
from datetime import date
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
class MyTimer(threading.Timer):
 | 
			
		||||
    def run(self):
 | 
			
		||||
        print(self.__dict__)
 | 
			
		||||
        print(f"{self._name} Run once")
 | 
			
		||||
        while not self.finished.wait(self.interval):
 | 
			
		||||
            print(f"{self._name} Run x")
 | 
			
		||||
            self.function(*self.args, **self.kwargs)
 | 
			
		||||
            print(f"{self._name} Ran x")
 | 
			
		||||
        print(f"{self._name} Run end")
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
def maketimer(cooldown, func):
 | 
			
		||||
    timer = MyTimer(cooldown, func)
 | 
			
		||||
    timer.daemon = True
 | 
			
		||||
    return timer
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
def setupLogger():
 | 
			
		||||
    """
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue