Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
I
imap-clean
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
ai3
tools
imap-clean
Commits
07bc4fe8
Commit
07bc4fe8
authored
2 years ago
by
ale
Browse files
Options
Downloads
Patches
Plain Diff
Add --batch-size command-line flag
parent
2522a18a
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
imap_clean.go
+3
-4
3 additions, 4 deletions
imap_clean.go
with
3 additions
and
4 deletions
imap_clean.go
+
3
−
4
View file @
07bc4fe8
...
...
@@ -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
)
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment