Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re: IMAPClient Fails when storing large amount of messages in deleted

by naChoZ (Curate)
on Oct 17, 2013 at 18:14 UTC ( #1058660=note: print w/replies, xml ) Need Help??


in reply to IMAPClient Fails when storing large amount of messages in deleted

It's more likely that it's timing out while waiting for the imap server to complete the operation. Instead of sending a mass delete of a bunch of messages, break it up into chunks. Something along the lines of:

my $msgset = Mail::IMAPClient::MessageSet->new( $imap->messages ); my $msg_ids = []; if ( $msgset ) { $msg_ids = $msgset->unfold; } while ( my @cur_block = splice @$msg_ids, 0, 500 ) { # delete the current block of messages... }

Untested of course. Hopefully that gets you going in the right direction.

--
Andy

  • Comment on Re: IMAPClient Fails when storing large amount of messages in deleted
  • Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1058660]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (7)
As of 2021-10-24 11:44 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My first memorable Perl project was:







    Results (89 votes). Check out past polls.

    Notices?