diff --git a/modules/seen.py b/modules/seen.py index 729764a..1467c45 100755 --- a/modules/seen.py +++ b/modules/seen.py @@ -140,6 +140,7 @@ def dump_seen_db(bot): @hook(True) @require_chanmsg def seen_hook(bot, trigger): + bot.memory["seen_lock"].acquire() last = (time.time(), trigger.channel, trigger.group(0)) if not trigger.nick in bot.memory["seen"]: first = (time.time(), trigger.channel, trigger.group(0)) @@ -147,6 +148,7 @@ def seen_hook(bot, trigger): first = bot.memory["seen"][trigger.nick][:3] seen = first + last bot.memory["seen"][trigger.nick] = seen + bot.memory["seen_lock"].release() if time.time() - bot.memory["seen_last_dump"] > 1: # only dump once a minute at most