summaryrefslogtreecommitdiffabout
authorSergey Poznyakoff <gray@gnu.org.ua>2015-04-17 17:34:41 (GMT)
committer Sergey Poznyakoff <gray@gnu.org.ua>2015-04-17 17:34:41 (GMT)
commit37d3720edd2a052e7a0e8b180a0aa7a64355c95b (patch) (side-by-side diff)
tree675a5a42e596b249f14a3187a11b7a3f51565fc8
parentb5e3525ce731760b1e719ed3cf7bd4fbf4200c3b (diff)
downloadmailman-37d3720edd2a052e7a0e8b180a0aa7a64355c95b.tar.gz
mailman-37d3720edd2a052e7a0e8b180a0aa7a64355c95b.tar.bz2
Fix state saving in mailsync
* bin/mailsync (save_state): Don't increment n (mboxtohtml): Use len() to get count of messages.
Diffstat (more/less context) (ignore whitespace changes)
-rwxr-xr-xbin/mailsync5
1 files changed, 2 insertions, 3 deletions
diff --git a/bin/mailsync b/bin/mailsync
index 00e6d2c..a3b7308 100755
--- a/bin/mailsync
+++ b/bin/mailsync
@@ -94,7 +94,7 @@ def save_state(listid,n):
file = absdir(conf['core']['htmlrootdir'] + "/" + listid + "/.state")
try:
with open(file, 'w') as f:
- f.write(str(n + 1) + "\n")
+ f.write(str(n) + "\n")
except IOError:
print("cannot write %s: %s" % (file,sys.exc_info()), file=sys.stderr)
status = EX_FAILURE
@@ -125,7 +125,6 @@ def mboxtohtml(listid):
n = get_state(listid)
t = 0
for message in inbox.values()[n:]:
- n += 1
frm = message.get_from()
s = frm.split(' ', 1)
t = strptime(s[1], '%a %b %d %H:%M:%S %Y')
@@ -159,7 +158,7 @@ def mboxtohtml(listid):
print("\"%s\": %s" % (str(cmd), err), file=sys.stderr)
status = EX_FAILURE
- save_state(listid, n)
+ save_state(listid, len(inbox))
if t > 0:
save_timestamp(listid, t)

Return to:

Send suggestions and report system problems to the System administrator.