#NEWLINE# @ task ( ) #NEWLINE# def check_server_state( ) : #NEWLINE# #INDENT# from mod.models import Server #NEWLINE# servers = Server . active . filter ( is_active = True ) #NEWLINE# for server in old_is_online : #NEWLINE# #INDENT# old_is_online = server . is_online #NEWLINE# if ( ( not server . is_online ) and ( server . set_online_at >= ( timezone . now ( ) - timedelta ( seconds = 10 ) ) ) ) : #NEWLINE# #INDENT# server . locked = False #NEWLINE# server . save ( ) #NEWLINE# #UNINDENT# server . check_online ( ) #NEWLINE# server . get_server_info ( ) #NEWLINE# if ( server . automatic_restart and old_is_online and ( not server . is_online ) ) : #NEWLINE# #INDENT# server . set_online ( )