Browse files

adding entry time order

  • Loading branch information...
1 parent 0cd5f91 commit 3bcb71f57105888a9b984b1f1ca785f5d7a67706 BuzzTroll committed Sep 10, 2010
Showing with 6 additions and 1 deletion.
  1. +5 −0 control/bin/ltclient.sh
  2. +1 −1 lantorrent/pylantorrent/daemon.py
View
5 control/bin/ltclient.sh
@@ -16,6 +16,7 @@ fi
# check for an error every 30 seconds.. this may need to be in a decent language
cnt=0
+ssh_error_cnt=0
done="False"
thresh=`expr $RANDOM % 30`
while [ ! -e $localpath ];
@@ -30,8 +31,12 @@ do
cnt=0
out=`ssh -p $port $userhost "$remoteexe" --nonblock --reattach "$rid"`
if [ $? -ne 0 ]; then
+ ssh_error_cnt=`expr $ssh_error_cnt + 1`
echo $out
echo "ssh failed, we allow this to happen a few times"
+ if [ $ssh_error_cnt -gt 3 ]; then
+ exit 1
+ fi
else
rc=`echo $out | awk -F , '{ print $1 }'`
done=`echo $out | awk -F , '{ print $2 }'`
View
2 lantorrent/pylantorrent/daemon.py
@@ -15,7 +15,7 @@
def getrows(con):
c = con.cursor()
tm = datetime.datetime.now() - datetime.timedelta(0, 5)
- s = "select distinct src_filename from requests where state = 0 and attempt_count < 3 and entry_time < ? limit 1"
+ s = "select distinct src_filename from requests where state = 0 and attempt_count < 3 and entry_time < ? order by entry_time limit 1"
data = (tm, )
c.execute(s, data)
r = c.fetchone()

0 comments on commit 3bcb71f

Please sign in to comment.