Fix 24 hours thingy.

This commit is contained in:
Jeremy Fincher 2004-09-16 12:11:54 +00:00
parent cab512a86f
commit 46eab7681a
1 changed files with 4 additions and 4 deletions

View File

@ -109,6 +109,7 @@ def search(log, queries, **kwargs):
conf.supybot.plugins.Google.state.searches.setValue(searches) conf.supybot.plugins.Google.state.searches.setValue(searches)
time = conf.supybot.plugins.Google.state.time() + data.meta.searchTime time = conf.supybot.plugins.Google.state.time() + data.meta.searchTime
conf.supybot.plugins.Google.state.time.setValue(time) conf.supybot.plugins.Google.state.time.setValue(time)
last24hours.enqueue(None)
return data return data
except socket.error, e: except socket.error, e:
if e.args[0] == 110: if e.args[0] == 110:
@ -190,16 +191,16 @@ conf.registerGlobalValue(conf.supybot.plugins.Google.state, 'time',
registry.Float(0.0, """Used to keep the total amount of time Google has registry.Float(0.0, """Used to keep the total amount of time Google has
spent searching for this bot. You shouldn't modify this.""")) spent searching for this bot. You shouldn't modify this."""))
searches = conf.supybot.plugins.Google.state.searches() last24hours = structures.TimeoutQueue(86400)
totalTime = conf.supybot.plugins.Google.state.time() totalTime = conf.supybot.plugins.Google.state.time()
searches = conf.supybot.plugins.Google.state.searches()
class Google(callbacks.PrivmsgCommandAndRegexp): class Google(callbacks.PrivmsgCommandAndRegexp):
threaded = True threaded = True
callBefore = ['URL'] callBefore = ['URL']
regexps = ['googleSnarfer', 'googleGroups'] regexps = ['googleSnarfer', 'googleGroups']
def __init__(self): def __init__(self):
callbacks.PrivmsgCommandAndRegexp.__init__(self) super(Google, self).__init__()
self.last24hours = structures.TimeoutQueue(86400)
google.setLicense(self.registryValue('licenseKey')) google.setLicense(self.registryValue('licenseKey'))
_colorGoogles = {} _colorGoogles = {}
@ -230,7 +231,6 @@ class Google(callbacks.PrivmsgCommandAndRegexp):
def formatData(self, data, bold=True, max=0): def formatData(self, data, bold=True, max=0):
if isinstance(data, basestring): if isinstance(data, basestring):
return data return data
self.last24hours.enqueue(None)
t = 'Search took %s seconds' % data.meta.searchTime t = 'Search took %s seconds' % data.meta.searchTime
results = [] results = []
if max: if max: