anchor.diff:  	if(IsConnected())
   		return TRUE
   
  -	if(failed_connections > FAILED_DB_CONNECTION_CUTOFF)	//If it failed to establish a connection more than 5 times in a row, don't bother attempting to connect anymore.
  +	if(failed_connection_timeout <= world.time) //it's been more than 5 seconds since we failed to connect, reset the counter
  +		failed_connections = 0
  +
  +	if(failed_connections > FAILED_DB_CONNECTION_CUTOFF)	//If it failed to establish a connection more than 5 times in a row, don't bother attempting to connect for 5 seconds.
  +		failed_connection_timeout = world.time + 50
   		return FALSE
   
   	if(!CONFIG_GET(flag/sql_enabled))
  
positive.code: 	if(!async)
  		start_time = REALTIMEOFDAY
  	Close()
  	query = connection.BeginQuery(sql)
  	if(!async)
  		timed_out = !query.WaitForCompletion()
  	else
  		in_progress = TRUE
  		UNTIL(query.IsComplete())
  		in_progress = FALSE
  	skip_next_is_complete = TRUE
  	var/error = QDELETED(query) ? "Query object deleted!" : query.GetError()
  	last_error = error
  
negative.code: 		log_query_debug("Query used: [sql]")
  		slow_query_check()
  
  /datum/DBQuery/proc/run_query(async)
  	query = connection.BeginQuery(sql)
  	if(!async)
  		. = !query.WaitForCompletion()
  	else
  		in_progress = TRUE
  		UNTIL(query.IsComplete())
  		in_progress = FALSE
  
  /datum/DBQuery/proc/slow_query_check()
  	message_admins("HEY! A database query timed out. Did the server just hang? <a href='?_src_=holder;[HrefToken()];slowquery=yes'>\[YES\]</a>|<a href='?_src_=holder;[HrefToken()];slowquery=no'>\[NO\]</a>")
  
  