Set game directory listing to update every 30 mins, changed setting to GAME_DIRECTORY_LISTING and removed too verbose logging.

This commit is contained in:
Griatch 2016-04-04 20:23:15 +02:00
parent bc04d5f99e
commit 8f1378c47e
3 changed files with 39 additions and 34 deletions

View file

@ -59,8 +59,8 @@ Evennia server has finished starting:
can be added to it). The function should not return anything. Plugin
services are started last in the Server startup process.
"""
from evennia.contrib.gamedir_client import EvenniaGameDirService
from evennia.contrib.gamedir_client import EvenniaGameDirService
def start_plugin_services(server):
"""
@ -79,7 +79,7 @@ Next, configure your game listing by opening up `server/conf/settings.py` and
# Contrib config
######################################################################
GAMEDIR_CLIENT = {
GAME_DIRECTORY_LISTING = {
'game_status': 'pre-alpha',
'listing_contact': 'me@my-game.com',
'telnet_hostname': 'my-game.com',
@ -92,7 +92,7 @@ At this point, you should be all set! Simply restart your game and check the
server logs for errors. Your listing and some game state will be sent every
half hour.
## Possible GAMEDIR_CLIENT settings
## Possible GAMEDIR_DIRECTORY_LISTING settings
### game_status

View file

@ -29,6 +29,7 @@ class EvenniaGameDirClient(object):
self.report_host = 'http://evennia-game-directory.appspot.com'
self.report_path = '/api/v1/game/check_in'
self.report_url = self.report_host + self.report_path
self.logged_first_connect = False
self._on_bad_request = on_bad_request
# Oh, the humanity. Silence the factory start/stop messages.
@ -43,8 +44,10 @@ class EvenniaGameDirClient(object):
"""
status_code, response_body = yield self._form_and_send_request()
if status_code == 200:
logger.log_infomsg(
"Successfully sent game details to Evennia Game Directory.")
if not self.logged_first_connect:
logger.log_infomsg(
"Successfully sent game details to Evennia Game Directory.")
self.logged_first_connect = True
return
# At this point, either EGD is having issues or the payload we sent
# is improperly formed (probably due to mis-configuration).
@ -64,7 +67,7 @@ class EvenniaGameDirClient(object):
'User-Agent': ['Evennia Game Directory Client'],
'Content-Type': ['application/x-www-form-urlencoded'],
}
gd_config = settings.GAMEDIR_CLIENT
gd_config = settings.GAME_DIRECTORY_LISTING
values = {
'game_name': settings.SERVERNAME,
'game_status': gd_config['game_status'],

View file

@ -4,6 +4,8 @@ from twisted.internet.task import LoopingCall
from evennia.contrib.gamedir_client.client import EvenniaGameDirClient
from evennia.utils import logger
# How often to sync to the server
_CLIENT_UPDATE_RATE = 60 * 30
class EvenniaGameDirService(Service):
"""
@ -20,7 +22,7 @@ class EvenniaGameDirService(Service):
def startService(self):
super(EvenniaGameDirService, self).startService()
# TODO: Check to make sure that the client is configured.
self.loop.start(10)
self.loop.start(_CLIENT_UPDATE_RATE)
def stopService(self):
if self.running == 0: