def _server_maintenance():
 global EVENNIA, _MAINTENANCE_COUNT, _FLUSH_CACHE, _GAMETIME_MODULE
 if (not _FLUSH_CACHE):
  from evennia.utils.idmapper.models import conditional_flush as _FLUSH_CACHE
 if (not _GAMETIME_MODULE):
  from evennia.utils import gametime as _GAMETIME_MODULE
 _MAINTENANCE_COUNT += 1
 now = time.time()
 if (_MAINTENANCE_COUNT == 1):
  _GAMETIME_MODULE.SERVER_START_TIME = now
  _GAMETIME_MODULE.SERVER_RUNTIME = ServerConfig.objects.conf('runtime', default=0.0)
 else:
  _GAMETIME_MODULE.SERVER_RUNTIME += 60.0
 _GAMETIME_MODULE.SERVER_RUNTIME_LAST_UPDATED = now
 ServerConfig.objects.conf('runtime', _GAMETIME_MODULE.SERVER_RUNTIME)
 if ((_MAINTENANCE_COUNT % 300) == 0):
  _FLUSH_CACHE(_IDMAPPER_CACHE_MAXSIZE)
 if ((_MAINTENANCE_COUNT % 3600) == 0):
  evennia.ScriptDB.objects.validate()
 if ((_MAINTENANCE_COUNT % 3700) == 0):
  evennia.CHANNEL_HANDLER.update()

def _server_maintenance ( ) : global EVENNIA , _MAINTENANCE_COUNT , _FLUSH_CACHE , _GAMETIME_MODULE if ( not _FLUSH_CACHE ) : from evennia . utils . idmapper . models import conditional_flush as _FLUSH_CACHE if ( not _GAMETIME_MODULE ) : from evennia . utils import gametime as _GAMETIME_MODULE _MAINTENANCE_COUNT += 1 now = time . time ( ) if ( _MAINTENANCE_COUNT == 1 ) : _GAMETIME_MODULE . SERVER_START_TIME = now _GAMETIME_MODULE . SERVER_RUNTIME = ServerConfig . objects . conf ( 'runtime' , default = 0.0 ) else : _GAMETIME_MODULE . SERVER_RUNTIME += 60.0 _GAMETIME_MODULE . SERVER_RUNTIME_LAST_UPDATED = now ServerConfig . objects . conf ( 'runtime' , _GAMETIME_MODULE . SERVER_RUNTIME ) if ( ( _MAINTENANCE_COUNT % 300 ) == 0 ) : _FLUSH_CACHE ( _IDMAPPER_CACHE_MAXSIZE ) if ( ( _MAINTENANCE_COUNT % 3600 ) == 0 ) : evennia . ScriptDB . objects . validate ( ) if ( ( _MAINTENANCE_COUNT % 3700 ) == 0 ) : evennia . CHANNEL_HANDLER . update ( )
this maintenance function handles repeated checks and updates that the server needs to do .