edit
This commit is contained in:
		
							parent
							
								
									2a80c87d22
								
							
						
					
					
						commit
						0aeb620679
					
				
							
								
								
									
										10
									
								
								main.py
								
								
								
								
							
							
						
						
									
										10
									
								
								main.py
								
								
								
								
							| 
						 | 
				
			
			@ -19,7 +19,7 @@ yellow=(0x00,0xcc,0xff)
 | 
			
		|||
light_green=(0x33,0xff,0xcc)
 | 
			
		||||
green=(0x00,0xcc,0x00)
 | 
			
		||||
imgpath="/tmp/uptime-graph/"
 | 
			
		||||
def update_history(history):
 | 
			
		||||
def update_history(history,recent):
 | 
			
		||||
    average=0
 | 
			
		||||
    for i in recent:
 | 
			
		||||
        average+=i
 | 
			
		||||
| 
						 | 
				
			
			@ -75,7 +75,7 @@ if __name__=="__main__":
 | 
			
		|||
            if len(recent_blog)<10:
 | 
			
		||||
                recent_blog.append(delay)
 | 
			
		||||
            else:
 | 
			
		||||
                update_history(blog)
 | 
			
		||||
                update_history(blog,recent_blog)
 | 
			
		||||
                update_graph("blog.png",blog)
 | 
			
		||||
                recent_blog=[]
 | 
			
		||||
                recent_blog.append(delay)
 | 
			
		||||
| 
						 | 
				
			
			@ -92,7 +92,7 @@ if __name__=="__main__":
 | 
			
		|||
            if len(recent_cloud)<10:
 | 
			
		||||
                recent_cloud.append(delay)
 | 
			
		||||
            else:
 | 
			
		||||
                update_history(cloud)
 | 
			
		||||
                update_history(cloud,recent_cloud)
 | 
			
		||||
                update_graph("cloud.png",cloud)
 | 
			
		||||
                recent_cloud=[]
 | 
			
		||||
                recent_cloud.append(delay)
 | 
			
		||||
| 
						 | 
				
			
			@ -109,7 +109,7 @@ if __name__=="__main__":
 | 
			
		|||
            if len(recent_code)<10:
 | 
			
		||||
                recent_code.append(delay)
 | 
			
		||||
            else:
 | 
			
		||||
                update_history(code)
 | 
			
		||||
                update_history(code,recent_code)
 | 
			
		||||
                update_graph("code.png",code)
 | 
			
		||||
                recent_code=[]
 | 
			
		||||
                recent_code.append(delay)
 | 
			
		||||
| 
						 | 
				
			
			@ -126,7 +126,7 @@ if __name__=="__main__":
 | 
			
		|||
            if len(recent_git)<10:
 | 
			
		||||
                recent_git.append(delay)
 | 
			
		||||
            else:
 | 
			
		||||
                update_history(git)
 | 
			
		||||
                update_history(git,recent_git)
 | 
			
		||||
                update_graph("git.png",git)
 | 
			
		||||
                recent_git=[]
 | 
			
		||||
                recent_git.append(delay)
 | 
			
		||||
		Loading…
	
		Reference in New Issue