diff options
| author | Barry Warsaw | 2009-01-04 16:55:59 -0500 |
|---|---|---|
| committer | Barry Warsaw | 2009-01-04 16:55:59 -0500 |
| commit | db71ff9519b6ef6146e2961c250ec88f118c9e94 (patch) | |
| tree | 97a576258499d7d8bd242a5ccd201a2f95a80394 /mailman/queue/docs | |
| parent | 59d2b6181ffa9517da97a6eb43a51396b1ff04f4 (diff) | |
| parent | 76787dfaa5c5931089f4f4d807dea9dd1fb7784c (diff) | |
| download | mailman-db71ff9519b6ef6146e2961c250ec88f118c9e94.tar.gz mailman-db71ff9519b6ef6146e2961c250ec88f118c9e94.tar.zst mailman-db71ff9519b6ef6146e2961c250ec88f118c9e94.zip | |
Mark's backport of file preservation in the queue runners. Test and cleanup
by Barry.
Diffstat (limited to 'mailman/queue/docs')
| -rw-r--r-- | mailman/queue/docs/switchboard.txt | 37 |
1 files changed, 33 insertions, 4 deletions
diff --git a/mailman/queue/docs/switchboard.txt b/mailman/queue/docs/switchboard.txt index 7baee7b54..741d435e1 100644 --- a/mailman/queue/docs/switchboard.txt +++ b/mailman/queue/docs/switchboard.txt @@ -22,9 +22,11 @@ Create a switchboard by giving its queue directory. Here's a helper function for ensuring things work correctly. - >>> def check_qfiles(): + >>> def check_qfiles(directory=None): + ... if directory is None: + ... directory = queue_directory ... files = {} - ... for qfile in os.listdir(queue_directory): + ... for qfile in os.listdir(directory): ... root, ext = os.path.splitext(qfile) ... files[ext] = files.get(ext, 0) + 1 ... return sorted(files.items()) @@ -133,12 +135,39 @@ place. These can be recovered when the switchboard is instantiated. >>> check_qfiles() [('.pck', 3)] -Clean up +The files can be recovered explicitly. >>> for filebase in switchboard.files: ... msg, msgdata = switchboard.dequeue(filebase) - ... switchboard.finish(filebase) + ... # Don't call .finish() + >>> check_qfiles() + [('.bak', 3)] + >>> switchboard.recover_backup_files() >>> check_qfiles() + [('.pck', 3)] + +But the files will only be recovered at most three times before they are +considered defective. In order to prevent mail bombs and loops, once this +maximum is reached, the files will be preserved in the 'bad' queue. + + >>> for filebase in switchboard.files: + ... msg, msgdata = switchboard.dequeue(filebase) + ... # Don't call .finish() + >>> check_qfiles() + [('.bak', 3)] + >>> switchboard.recover_backup_files() + >>> check_qfiles() + [] + + >>> bad = config.switchboards['bad'] + >>> check_qfiles(bad.queue_directory) + [('.psv', 3)] + +Clean up + + >>> for file in os.listdir(bad.queue_directory): + ... os.remove(os.path.join(bad.queue_directory, file)) + >>> check_qfiles(bad.queue_directory) [] |
