Permalink
Browse files

fixed a bug in the direct message parsing. i wasn't pulling the most …

…recent direct message id, i was pulling the oldest one. this resulted in all direct messages being parsed over and over again.
  • Loading branch information...
1 parent 63b32e1 commit 954989251666283f5f6460050e90fffc165c5d11 User committed Jul 3, 2009
Showing with 3 additions and 1 deletion.
  1. +3 −1 tweetBot.py
View
@@ -2,6 +2,7 @@
import time
from model import *
from sqlalchemy import func
+from sqlalchemy.sql.expression import *
from ConfigParser import RawConfigParser
import optparse
import sys
@@ -89,11 +90,12 @@ def recordMessage(self, message):
def getMessages(self):
prevMsgs = DirectMessages.query().order_by(
- DirectMessages.messageTime).limit(1).all()
+ desc(DirectMessages.messageTime)).limit(1).all()
if len(prevMsgs) < 1:
lastMessageID = None
else:
lastMessageID = prevMsgs[0].messageID
+ print "Getting Direct Messages since %s " %(lastMessageID)
messages = self.tbox.direct_messages(since_id = lastMessageID)
for aMessage in messages:
self.recordMessage(aMessage)

0 comments on commit 9549892

Please sign in to comment.