From c29e789a8297ebd7ec4f90731dc19d016dbaabb1 Mon Sep 17 00:00:00 2001 From: bwarsaw Date: Wed, 15 Dec 1999 23:13:21 +0000 Subject: When sending a list's digest, the list must be locked, and must be saved after sending, otherwise the digest numbers and post numbers are not tracked correctly. --- cron/senddigests | 30 ++++++++++++++++++++---------- 1 file changed, 20 insertions(+), 10 deletions(-) diff --git a/cron/senddigests b/cron/senddigests index c3d2ff347..f580bd112 100755 --- a/cron/senddigests +++ b/cron/senddigests @@ -39,16 +39,26 @@ def main(): for listname in Utils.list_names(): mlist = MailList.MailList(listname, lock=0) if mlist.digest_send_periodic: - # send the digest if there are any partially built - digestfile = os.path.join(mlist.fullpath(), 'next-digest') - topicsfile = os.path.join(mlist.fullpath(), 'next-digest-topics') - try: - if os.stat(digestfile)[ST_SIZE] > 0: - ToDigest.inject_digest(mlist, digestfile, topicsfile) - except os.error, (code, msg): - if code <> ENOENT: - raise - # otherwise, this list doesn't have any outstanding digests + send_list_digest(mlist) + + +def send_list_digest(mlist): + mlist.Lock() + try: + # send the digest if there are any partially built + digestfile = os.path.join(mlist.fullpath(), 'next-digest') + topicsfile = os.path.join(mlist.fullpath(), 'next-digest-topics') + try: + if os.stat(digestfile)[ST_SIZE] > 0: + ToDigest.inject_digest(mlist, digestfile, topicsfile) + except os.error, (code, msg): + if code <> ENOENT: + raise + # otherwise, this list doesn't have any outstanding digests + finally: + mlist.Save() + mlist.Unlock() + if __name__ == "__main__": -- cgit v1.2.3-70-g09d2