Browse Source

Merge 713df0f0d8 into cc574cec6d

pull/47/merge
Kunal Mehta 7 years ago
committed by GitHub
parent
commit
e3aafcfcdb
1 changed files with 9 additions and 2 deletions
  1. +9
    -2
      earwigbot/commands/lag.py

+ 9
- 2
earwigbot/commands/lag.py View File

@@ -23,6 +23,8 @@
from earwigbot import exceptions from earwigbot import exceptions
from earwigbot.commands import Command from earwigbot.commands import Command


old = 99999999999999999999999

class Lag(Command): class Lag(Command):
"""Return replag or maxlag information on specific databases.""" """Return replag or maxlag information on specific databases."""
name = "lag" name = "lag"
@@ -32,17 +34,22 @@ class Lag(Command):
site = self.get_site(data) site = self.get_site(data)
if not site: if not site:
return return
replag = self.get_replag(site)
if data.command == "replag": if data.command == "replag":
base = "\x0302{0}\x0F: {1}." base = "\x0302{0}\x0F: {1}."
msg = base.format(site.name, self.get_replag(site))
msg = base.format(site.name, replag)
elif data.command == "maxlag": elif data.command == "maxlag":
base = "\x0302{0}\x0F: {1}." base = "\x0302{0}\x0F: {1}."
msg = base.format(site.name, self.get_maxlag(site)) msg = base.format(site.name, self.get_maxlag(site))
else: else:
base = "\x0302{0}\x0F: {1}; {2}." base = "\x0302{0}\x0F: {1}; {2}."
msg = base.format(site.name, self.get_replag(site),
msg = base.format(site.name, replag,
self.get_maxlag(site)) self.get_maxlag(site))
self.reply(data, msg) self.reply(data, msg)
global old
if replag > old:
self.reply(data, 'EWW WHY')
old = replag


def get_replag(self, site): def get_replag(self, site):
return "SQL replag is {0}".format(self.time(site.get_replag())) return "SQL replag is {0}".format(self.time(site.get_replag()))


Loading…
Cancel
Save