Skip to content
Snippets Groups Projects
Commit 07bc4fe8 authored by ale's avatar ale
Browse files

Add --batch-size command-line flag

parent 2522a18a
No related branches found
No related tags found
No related merge requests found
......@@ -26,6 +26,7 @@ var (
dryRun = flag.Bool("dry-run", false, "do not actually delete messages")
folder = flag.String("folder", "INBOX", "remote IMAP folder")
verbose = flag.Bool("verbose", false, "print additional debug messages")
batchSize = flag.Int("batch-size", 100, "deletion batch size")
)
func vlog(fmt string, args ...interface{}) {
......@@ -92,11 +93,9 @@ func buildCriteria() (*imap.SearchCriteria, error) {
return crit, nil
}
const batchSize = 200
func uidBatch(c *client.Client, uids []uint32, f func([]uint32) error) error {
for i := 0; i < len(uids); i += batchSize {
j := i + batchSize
for i := 0; i < len(uids); i += *batchSize {
j := i + *batchSize
if j > len(uids) {
j = len(uids)
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment