mirror of
https://github.com/evennia/evennia.git
synced 2026-03-23 08:16:30 +01:00
EGD: Delay the first check-in long enough to prevent false 0-player counts.
This commit is contained in:
parent
d1f5e7fdeb
commit
db988b242b
1 changed files with 10 additions and 2 deletions
|
|
@ -1,12 +1,16 @@
|
|||
from twisted.application.service import Service
|
||||
from twisted.internet import reactor
|
||||
from twisted.internet.task import LoopingCall
|
||||
from twisted.application.service import Service
|
||||
|
||||
from evennia.contrib.gamedir_client.client import EvenniaGameDirClient
|
||||
from evennia.utils import logger
|
||||
|
||||
# How many seconds to wait before triggering the first EGD check-in.
|
||||
_FIRST_UPDATE_DELAY = 10
|
||||
# How often to sync to the server
|
||||
_CLIENT_UPDATE_RATE = 60 * 30
|
||||
|
||||
|
||||
class EvenniaGameDirService(Service):
|
||||
"""
|
||||
Twisted Service that contains a LoopingCall for sending details on a
|
||||
|
|
@ -22,7 +26,11 @@ class EvenniaGameDirService(Service):
|
|||
def startService(self):
|
||||
super(EvenniaGameDirService, self).startService()
|
||||
# TODO: Check to make sure that the client is configured.
|
||||
self.loop.start(_CLIENT_UPDATE_RATE)
|
||||
# Start the loop, but only after a short delay. This allows the
|
||||
# portal and the server time to sync up as far as total player counts.
|
||||
# Prevents always reporting a count of 0.
|
||||
reactor.callLater(
|
||||
_FIRST_UPDATE_DELAY, self.loop.start, _CLIENT_UPDATE_RATE)
|
||||
|
||||
def stopService(self):
|
||||
if self.running == 0:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue